Page 1 of 1

JS in the second window

Posted: Tue Mar 08, 2022 4:59 pm
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?

Re: JS in the second window

Posted: Wed Mar 09, 2022 8:53 am
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.

Re: JS in the second window

Posted: Sat Mar 19, 2022 5:04 pm
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

Re: JS in the second window

Posted: Sat Mar 19, 2022 5:38 pm
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()