c# webbrowser control, navigates on dynamic menu hover?
I have a form in my winforms app that acts as a built-in browser. It uses the .net webbrowser control. Pretty simple. I have a textbox as an address bar, and buttons for control. When I navigate to my website, my website uses a .net menu control to present a hover menu. When I hover over the menu (using my browser form), the address bar changes to: http://domainname/WebResource.axd?etc/etc/etc, unexpectedly
I am trapping the webbrowser_navigating event and setting the Text property of the address bar to e.Url.ToString()
Of course, this is not the expected result, and IE doesn't do this. What am I missing?
UPDATE:
Here's the only way I could come up with how to do this:
string url = e.Url.ToString().ToLower(); // Only change the address bar under certain circumstances // Filter out some navigating changes if ((StringUtil.Empty(e.TargetFrameName) || e.TargetFrameName.ToLower() == "_blank") && !url.Contains("webresource.axd") && 开发者_如何学Python !url.Contains("javascript:") && !url.Contains("about:blank")) { toolStripAddress.Text = e.Url.ToString(); }
See Sanjay's comment above.
精彩评论