Skip to content

set the title? #232

@r2evans

Description

@r2evans

Is your proposal related to a problem?

In a way, yes: I often have multiple R sessions running simultaneously. It would be great to be able to know from the browser tab (i.e., document.title) something about the R process I'm using.

For instance, since I use emacs/ess, the R process buffers are typically named something like *R:1:quux* where quux is the directory it was started from, and 1 is the nth R process buffer started.

With httpgd::hgd_browser(), the browser correctly opens the page, and the browser tab title says simply "httpgd", since that's what it is set to in index.html. I can go into the web-devtools object browser and change the title to something more meaningful to me in a multi-device workspace, such as:

Image Image

Describe the solution you'd like

Options?

  1. Since src/httpgd_webserver.cpp hard-codes that title, I don't know if it's easy to somehow make m_conf.wwwpath "per-instance", so the "index.html" could be a temporary copy of the template.

  2. All that is required to do this programmatically is to somehow call

    document.title = "*R:1:quux*";

    Is it possible to send that js to the server?

  3. If it's better/easier to "add an endpoint" to the server so that POSTing the string will change the title (security considerations), perhaps httpgd::hgd_settitle("*R:1:quux*") would allow me to update it more easily (than browser-console editing).

Describe alternatives you've considered

It is currently effective to manually edit the browser page in the web-browser dev console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions