Welcome Guest Search | Active Topics | Sign In | Register

How to restrict back button in EO.WebBrowsercontrol so it do not go to previous page in history Options
Tank
Posted: Tuesday, August 12, 2014 9:00:45 AM
Rank: Advanced Member
Groups: Member

Joined: 6/13/2014
Posts: 38
Hi

we are trying to restrict the back button behaviour, so if focus is on web browser control and user presses the back button it do not go to previous page. is there any event or property we need to handle set to restrict the back button.

Note: In textbox back button should work normally.

Regards,
Ashish
eo_support
Posted: Monday, August 18, 2014 10:22:54 PM
Rank: Administration
Groups: Administration

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

EO.WebBrowser does not provide any direct support for this, however you can use WebView.InitScript to automatically inject JavaScript code into the page you load:

http://www.essentialobjects.com/doc/6/eo.webbrowser.webview.jsinitcode.aspx

This page gives you sample JavaScript code on how to disable back key:

http://stackoverflow.com/questions/1495219/how-can-i-prevent-the-backspace-key-from-navigating-back

The above code uses JQuery syntax, so if your page does not use JQuery, then you might want to change that.

Thanks!
Tank
Posted: Tuesday, October 14, 2014 7:11:43 AM
Rank: Advanced Member
Groups: Member

Joined: 6/13/2014
Posts: 38
Hi EO_Support,

Thanks for your help. I have tried above solution and it will work for normal web pages but if there is any iframe in the web page and if user click back button this solution will not work as document.keydown will be bound to the main document element only and not with the opened iframe's document object.
Is there anyway in EO that we can inject JS code when ever any iframe is loaded ?

Regards,
Ashish
eo_support
Posted: Tuesday, October 14, 2014 11:38:18 AM
Rank: Administration
Groups: Administration

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

There appear to be no way to inject any js code into an iframe in the current version. It does make sense to run JSInitCode in all frames, not just top level frames though. It's something very easy for us to do but we will review a few things to make sure that it doesn't introduce any problem. If we do not see any problems, our next build will run JSInitCode in iframe as well.

Thanks!
eo_support
Posted: Tuesday, October 14, 2014 3:30:18 PM
Rank: Administration
Groups: Administration

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

We have posted a new build on our download page that runs JSInitCode inside iframe as well. Please take a look and let us know how it goes.

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.