Rank: Newbie Groups: Member
Joined: 6/25/2019 Posts: 3
|
I am trying to pass some javascript via EvalScript on a Webview during the NewWindow event and it doesn't seem to be getting to the WebView.
Private Sub WebView1_NewWindow(sender As Object, e As NewWindowEventArgs) Handles WebView1.NewWindow WebControl1.WebView.EvalScript("viewControl.open('a','" & e.TargetUrl & "','b');") e.Accepted = True End Sub
I've tried without e.Accepted and I have tried true and false. I don't want to open a NewWindow, but I want to pass the URL that is trying to be opened to WebView that raised the event.
Any advice would be appreciated.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
If you just want to load the Url, you can simply use "WebControl1.WebView.Url = e.TargetUrl".
You won't be able to do it with EvalScript. NewWindow is usually triggered by JavaScript window.open method and allowing EvalScript inside NewWindow handler will cause JavaScript engine to be re-entered (other JavaScript code to be called before window.open returns). This is not allowed.
Thanks!
|