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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

JS in the second window

Post Reply
pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

JS in the second window

Post by pushca »

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?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: JS in the second window

Post by salvadordf »

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.
pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

Re: JS in the second window

Post by pushca »

salvadordf 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.
I have this method showing a problem
Image
pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

Re: JS in the second window

Post by pushca »

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()
Post Reply