Page 1 of 1

Set custom page title?

Posted: Thu Nov 07, 2019 11:41 pm
by krylon
Hello everyone,

Is it possible to change the page title displayed in the web browser?

I would naively assume that this is something people commonly want to do, but I could not find any reference in the documentation.

(One could, of course, set the title by manually editing the generated HTML code, but this is not an elegant solution.)

Thanks for any hints,
Benjamin

Re: Set custom page title?

Posted: Sat Nov 09, 2019 6:32 pm
by MichaelHughes
Not tried it but I suspect

Interop.ExecuteJavaScript("document.title = $0;", "This is the new page title." );

You may need to escape the " in the title such as "\"This is the new page title.\""

See

http://cshtml5.com/links/how-to-call-javascript.aspx

for details

Re: Set custom page title?

Posted: Tue Nov 12, 2019 4:29 am
by krylon
Thank you very much! This works nicely! :D