Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need some way to get page/document title #27

Closed
dd8 opened this issue Jun 27, 2019 · 4 comments
Closed

Need some way to get page/document title #27

dd8 opened this issue Jun 27, 2019 · 4 comments
Labels
feature request feature request

Comments

@dd8
Copy link

dd8 commented Jun 27, 2019

MsHtml WebBrowserControl has DISPID_TITLECHANGE event
MFC CHtmlView has OnTitleChange event handler
Windows.UI.Xaml.Controls.WebView has DocumentTitle property
macOS WkWebView has title property

Needed for apps that display page title in their UI

Executing a script to get DOM document.title is not equivalent - what happens if scripting is disabled or document is not HTML (e.g. PDFs)

@david-risney david-risney added the feature request feature request label Jun 27, 2019
@david-risney
Copy link
Contributor

That makes sense. Great feedback. We'll look into this. Thanks!

@dd8
Copy link
Author

dd8 commented Jun 27, 2019

The property has the advantage of being simple, but there's no way to notify the app of a change (e.g. when view content fetched by XmlHttpRequest sets document.title) and you probably need locking to avoid accessing property during an async update.

The event handles changes to document.title naturally and might not require locking, but might not fit so well with the WebView2 event model.

@david-risney
Copy link
Contributor

Thanks. Just offhand I was imagining a DocumentTitle property and a DocumentTitleChanged event. We'll look into what works best.

@lingamy
Copy link
Collaborator

lingamy commented Sep 10, 2019

Hi Mark, thanks for submitting the feedback! We’ve added new APIs get_DocumentTitle and add_DocumentTitleChanged for getting the title of the current top level document and getting notification for the document title change in the new SDK update. Make sure you update the SDK and use the canary channel for testing.

@lingamy lingamy closed this as completed Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request
Projects
None yet
Development

No branches or pull requests

3 participants