You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the url argument in set_content() is required. But it stands to reason that, if you are directly setting raw HTML content, that content doesn't have a URL associated with it.
What we can currently do is pass an empty string to url: my_webview.set_content("", content=html_content)
But that's clunky.
Describe the solution you'd like
In the set_content() function, make the url argument optional.
Your assertion is incorrect - even if you don't specify a URL, a webview has a URL. That URL might be about:blank - but it's still a URL, and it can impact how page content is interpreted. GTK, iOS and macOS don't have an option to not specify a URL when loading content.
The closest we could do here would be to set it up such that mywebview.content = "<html>..." is an implicit call to mywebview.set_content("", "<html>...") - but the additional complication is that most web APIs don't provide a way to retrieve the page HTML content - so we need to define a setter, but without a getter.
Syntactically, that's not something Python allows - but I guess we could define the getter, but make it raise AttributeError so that it looks like it doesn't exist, and document that it's a write-only property, and advise that the setter is equivalent to set_content("", content).
What is the problem or limitation you are having?
Currently, the url argument in set_content() is required. But it stands to reason that, if you are directly setting raw HTML content, that content doesn't have a URL associated with it.
What we can currently do is pass an empty string to url:
my_webview.set_content("", content=html_content)
But that's clunky.
Describe the solution you'd like
In the set_content() function, make the url argument optional.
Describe alternatives you've considered
Perhaps #2851 can make this issue obsolete.
Additional context
No response
The text was updated successfully, but these errors were encountered: