Welcome Guest Search | Active Topics | Sign In | Register

EO.WebBrowser block all popups, prevent redirect to another page Options
chungpn
Posted: Friday, May 27, 2016 5:15:54 AM
Rank: Newbie
Groups: Member

Joined: 4/2/2015
Posts: 9
Hello support,

Where and how can I handle EO.WebBrowser event to prevent popups or redirect to another page. The website I load to EO.WebBrowser random automatic display popup and display another website. I just want to load an fixed url. Thank you.
eo_support
Posted: Friday, May 27, 2016 1:35:28 PM
Rank: Administration
Groups: Administration

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

You would need to handle NewWindow event:

http://www.essentialobjects.com/doc/webbrowser/advanced/new_window.aspx

This event is raised when the page requests a new window (popup). You can handle the event but do nothing in the event handler to deny the popup.

Thanks!
chungpn
Posted: Sunday, May 29, 2016 11:06:05 AM
Rank: Newbie
Groups: Member

Joined: 4/2/2015
Posts: 9
I do nothing in this event, but the wesite still tranfer to another url, the message below never show.

private void webView1_NewWindow(object sender, EO.WebBrowser.NewWindowEventArgs e)
{
MessageBox.Show("this website opening new window and not show");

}

otherwise, when the website change url, this event called and the message show.
private void webView1_UrlChanged(object sender, EventArgs e)
{
MessageBox.Show("this show");
}


Thank you.
chungpn
Posted: Monday, May 30, 2016 12:05:20 AM
Rank: Newbie
Groups: Member

Joined: 4/2/2015
Posts: 9
How can I not allow Url Change?
eo_support
Posted: Monday, May 30, 2016 12:13:41 PM
Rank: Administration
Groups: Administration

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

The NewWindow event is for popups. To prevent redirection, you can handle BeforeNavigate event and set e.Cancel to true in that event handler.

Thanks!
chungpn
Posted: Monday, May 30, 2016 9:20:28 PM
Rank: Newbie
Groups: Member

Joined: 4/2/2015
Posts: 9
many thanks.
eo_support
Posted: Tuesday, May 31, 2016 10:37:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
You are welcome. Please feel free to let us know if there is anything else.

Thanks!


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.