i need some advice for handling a Stop function for my browser. it must be caused by a buttonclick, so i think i will need javascript to solve this problem. Somebody already faced this issue?
greets roqstr
i need some advice for handling a Stop function for my browser. it must be caused by a buttonclick, so i think i will need javascript to solve this problem. Somebody already faced this issue?
greets roqstr
public MainPage()
{
InitializeComponent();
//wb is the webbrowser
wb.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(wb_LoadCompleted);
//pretty sure you need this somewhere other than the constructor, or you'll get that
//"cannot navigate until in visual tree" exception
wb.NavigateToString(MyHTMLString);
}
void wb_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
wb.Navigating += new EventHandler<NavigatingEventArgs>(wb_Navigating);
}
void wb_Navigating(object sender, NavigatingEventArgs e)
{
e.Cancel = true;
}
The idea is basically that. override LoadCompleted, and after the page you want to load loads, make sure that no other page can be navigated to by setting e.Cancel inside the Navigating event.