Set custom page title?

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
krylon
Posts: 6
Joined: Wed Sep 04, 2019 11:04 pm

Set custom page title?

Postby krylon » Thu Nov 07, 2019 11:41 pm

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

MichaelHughes
Posts: 41
Joined: Thu Oct 08, 2015 5:33 am

Re: Set custom page title?

Postby MichaelHughes » Sat Nov 09, 2019 6:32 pm

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

krylon
Posts: 6
Joined: Wed Sep 04, 2019 11:04 pm

Re: Set custom page title?

Postby krylon » Tue Nov 12, 2019 4:29 am

Thank you very much! This works nicely! :D


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 20 guests

 

 

cron