1. TheBeastinator's Avatar
    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?
    10-09-2012 02:23 AM
  2. Red Lemur's Avatar
    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
    TheBeastinator likes this.
    10-09-2012 04:59 AM
  3. TheBeastinator's Avatar
    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);
    [/code]

    'Back'/'Forward' you can do by invoking JavaScript on the browser:
    [code]
    MyBrowser.InvokeScript("eval", "history.go(-1)");
    [/code]
    (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;
    }
    [/code]

    Hope that helps,

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

    Thanks, i feel quite silly missing these obvious steps.
    10-19-2012 09:19 PM
LINK TO POST COPIED TO CLIPBOARD