简体   繁体   中英

Windows Phone 8 SDK - WebBrowser Control - How to refresh page from code

How can I refresh the webbrowser control from the code behind? I am using Windows 8 SDK & C#.

You can accomplish this by storing the most recent visited Url then when you need to refresh you just navigate to it.

private void browser_Navigated(object sender, NavigationEventArgs e) {
  lastUri = e.Uri;
}

private void Refresh() {
  browser.Navigate(lastUri);
}

You could do this via injecting JS into the page via the browser contr:

var js = "window.location.reload(true);";
Browser.InvokeScript("eval", js);

就是这样;

Browser.Navigate(new Uri(Browser.Source.AbsoluteUri));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM