is the web browser control...

TheBeastinator

New member
Sep 18, 2012
14
0
0
Hey

So i was busy messing with the web browser control, and to my surprise... The control is EXTREMELY limited!
Does it really have no "Forward, Back, Refresh, Stop Loading" the very basics?
 
It has all that - you just need to know how ;) These are from memory but should give you a rough idea.

e.g. refresh you can do by just navigating to the existing url:
Code:
MyBrowser.Navigate(MyBrowser.Source);

'Back'/'Forward' you can do by invoking JavaScript on the browser:
Code:
MyBrowser.InvokeScript("eval", "history.go(-1)");
(You may want to check first in your code there is something to go back to)

and Stop is a case of subscribing to the webbrowsercontrol's Navigating event and setting e.Cancel equal to true.
Code:
private void MyBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
     e.Cancel = true;
}

Hope that helps,

Ian
 
  • Like
Reactions: Jay Bennett
It has all that - you just need to know how ;) These are from memory but should give you a rough idea.

e.g. refresh you can do by just navigating to the existing url:
Code:
MyBrowser.Navigate(MyBrowser.Source);

'Back'/'Forward' you can do by invoking JavaScript on the browser:
Code:
MyBrowser.InvokeScript("eval", "history.go(-1)");
(You may want to check first in your code there is something to go back to)

and Stop is a case of subscribing to the webbrowsercontrol's Navigating event and setting e.Cancel equal to true.
Code:
private void MyBrowser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
     e.Cancel = true;
}

Hope that helps,

Ian
oooohhhh i see... so we invoke java script.

Thanks, i feel quite silly missing these obvious steps.
 

Trending Posts

Members online

Forum statistics

Threads
339,588
Messages
2,262,618
Members
428,761
Latest member
johnaw