Hello. I use Webview. On the site I work with, I connect my js
http://127.0.0.1/myJs .js every time the EdgeBrowser1NavigationCompleted event occurs. But this script does not work if a tab was opened in a new window. How to use it correctly?
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
JS in the second window
- salvadordf
- Posts: 4620
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: JS in the second window
Hi,
Try using TWVBrowserBase.AddScriptToExecuteOnDocumentCreated to execute scripts as soon as the document is created.
I would also use Delphi forms for the popup windows as shown in the PopupBrowser demo.
Try using TWVBrowserBase.AddScriptToExecuteOnDocumentCreated to execute scripts as soon as the document is created.
I would also use Delphi forms for the popup windows as shown in the PopupBrowser demo.
Re: JS in the second window
I have this method showing a problemsalvadordf wrote: Wed Mar 09, 2022 8:53 am Hi,
Try using TWVBrowserBase.AddScriptToExecuteOnDocumentCreated to execute scripts as soon as the document is created.
I would also use Delphi forms for the popup windows as shown in the PopupBrowser demo.

Re: JS in the second window
So. I added "uWVTypes" to "uses" and this call passed. After that, I realized that first I need to use the event WVBrowser1.AddScriptToExecuteOnDocumentCreated('my_js_code');
And you can get the result of successful execution through
WVBrowser1AddScriptToExecuteOnDocumentCreatedCompleted()
And you can get the result of successful execution through
WVBrowser1AddScriptToExecuteOnDocumentCreatedCompleted()