Open sjehuda opened 2 months ago
Hi! I assume you looking to intercept all requests (images, stylesheets, etc) and not block the loading of all external resources all together?
Not exactly.
I want to ignore or treat differently, any resource that is not of the original hostname.
I have made an HTML service (Blasta).
I want to utilize it as a desktop software, and so I do not want to allow opening of any link within the software itself; instead, I want any foreign resource (i.e. URL or URI) to open outside of the software.
See the argument https://github.com/r0x0r/pywebview/discussions/1459
And the use case https://github.com/r0x0r/pywebview/issues/1461#issuecomment-2363879373
I suppose, that I will contribute code to pywebview (they really should rename the project to pyhtmlview), in order to do so. The author has made some initial work on that matter.
Nevertheless, I am also interested to utilize TkinterWeb as a toolkit for desktop software, because it is even more lightweight.
On Fri, 11 Oct 2024 07:08:29 -0700 Andrew @.***> wrote:
Hi! I assume you looking to intercept all requests (images, stylesheets, etc) and not block the loading of all external resources all together?
Yes, that is quite easy to do. From the API Reference, can use on_link_click
to override the default behaviour for hyperlinks and on_form_submit
to handle form submissions. For instance, the following would open the resource in the default webbrowser rather than displaying it in TkinterWeb:
def load_new_page(url):
webbrowser.open(url)
myhtmlframe.on_link_click(load_new_page)
Good day, to one and all!
I am involved with a Python project called Blasta - An XMPP PubSub based annotation system.
https://github.com/user-attachments/assets/6f072651-e043-4786-8718-1e6801bd6466
Screenshots https://git.xmpp-it.net/sch/Blasta/src/branch/main/screenshot
The system is an annotation (also referred to as bibliography and bookmarks) management system.
I do not desire to open resources from within TkinterWeb.
Which means that using the module
webbrowser
is more viable over pywebview, unless it is possible to regulate access.Is it possible to block or treat differently to resources outside of specified hostnames?
This matter was raise at https://github.com/r0x0r/pywebview/discussions/1459