Welcome Guest Search | Active Topics | Sign In | Register

Problems with the NewWindows Event in a Webview that is not Wpf Options
Prequena84
Posted: Wednesday, June 1, 2022 9:28:39 AM
Rank: Advanced Member
Groups: Member

Joined: 5/10/2021
Posts: 43
hello good morning, I'm having a problem to generate the new windows window when the webview simulates the click, I was reviewing your example and it is focused on Wpf forms and I don't have an example of webview in a normal widows form until now I was trying to do this:

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click

Dim JS_CODE, JS_CODE2 As String

AddHandler WebView1.NewWindow, New NewWindowHandler(AddressOf WebView1_NewWindow)

JS_CODE = "(function()
{
try {

var class1 = document.getElementsByClassName('md:relative');
var class2 = class1[0].getElementsByClassName('js-track-ga-click');
//var tag1 = class2[0].getElementsByTagName('a');//

class2[0].click();

//return class1.length;//

} catch(err) {};

})();"

Me.WebControl1.WebView.EvalScript(JS_CODE)

End Sub


Public Sub WebView1_NewWindow(sender As Object, e As NewWindowEventArgs) Handles WebView1.NewWindow

Me.WebControl1.WebView.url = e.TargetUrl

End Sub

then it generates the message that tells me that I have to do the new windows event and it is not clear how to do the event, I need help because it is not clear in a webview that is not Wpf.
eo_support
Posted: Wednesday, June 1, 2022 10:49:53 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

Please read this topic:

https://www.essentialobjects.com/doc/webbrowser/advanced/new_window

Forget the WPF part. The key to handle this event is the browser engine gives you a new WebView (the popup window) and you must accomodate it. This is like a guest arrives at your hotel and your responsiblity is to give it a room. Exactly what kind of "room" you provide (WPF style or Windows.Forms style) is up to you. The browser engine does not care about that part.

Additionally, you can NOT run JavaScript code inside NewWindow event. This would cause the browser engine to be re-entered and it is not allowed.

Thanks!

Prequena84
Posted: Wednesday, June 1, 2022 1:54:14 PM
Rank: Advanced Member
Groups: Member

Joined: 5/10/2021
Posts: 43
Look, it will be that I give you my client and you serve him better in this project, I was thinking of recommending his App, I was thinking of finishing the App and they had the intention of buying his license and yet how am I going to reach them now without the information and without the examples of how to cause the event of the new window, that URL that you have indicated to me does not explain how to do the example itself, it is a part of a code of your App "TabbedBrowser_VB", I am searching and reading and explains the theory and it seems to me that this does not explain how to control it, nothing appears, in your examples the use of the DockItem,WebPage, WebViewItem plugin appears and I do not understand how it works or how to engage that event, how do we do it, I need an example of more summarized to analyze it, understand how its complement works, I have understood a lot of things but I have problems with this point, if not I will receive support, please let me know and I will cancel this project and I will recommend another solution n to my client.

Thank you.
Prequena84
Posted: Wednesday, June 1, 2022 2:17:54 PM
Rank: Advanced Member
Groups: Member

Joined: 5/10/2021
Posts: 43
I am testing the website in its App and it does not work, I click on it and it does not open the pop-up window with the information and it does not work
eo_support
Posted: Wednesday, June 1, 2022 2:26:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
We are supporting you --- but you have to tell us exactly which part you do not understand. Our product is for software developers, so you can't just imagine things out of your head and expect it to work, nor can you just copy the sample code and expect it to work for your specific scenario. You need to read our documentation and sample line by line and adapt it to fit your own need.

The basic flow of handling this event has nothing to do with WPF so you can just completely ingore that part. All you need to do in your event handler is to put the new WebView somewhere. If you are still confused, you need to explain to us exactly which part of "put the new WebView somewhere" you do not understand so that we can help you further. You can't just say "it doesn't work and I do not understand". You need to be able to follow step by step instructions and tell us exactly which step you are having trouble with so that we can give you more detailed answers on those steps.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.