tags:

views:

304

answers:

1

Hi all,

I'm working on a full-trust WPF browser application (XBAP) and have come across a snag. An application on the client is wired to handle navigation requests with a certain prefix/protocol. (For example, 'foo://...") Additionally, the application handles these differently depending on which browser creates the request. I've tried the Page's 'NavigationService.Navigate()' method, but for some strange reason this involves WebRequest objects, which raises a NotSupportedException saying "The URI prefix is not recognized." I can create a WebBrowser control and successfully navigate IT with this prefix, but the application recognizes it as a different browser and reacts differently. If I were using Silverlight, I'd be to directly set the browser's 'window.location' which works perfectly. But of course, this is only appears to be available in the Silverlight framework.

So bottom line, what I need to do is trigger the browser hosting the XBAP to navigate to a URI with this special prefix.

Whew. That's all, I think. Thanks.

Update: The .Net Framework 4.0 will allow direct access to the browser's DOM which will solve this problem, however I am still scrounging for ways of accomplishing this in .Net 3.x.

+2  A: 

You can try to use BrowserInteropHelper.ClientSite to access the DOM. Check out this post for a sample:

http://blogs.msdn.com/changov/archive/2009/03/01/scripting-out-of-an-xbap.aspx

Note that this would only work for Internet Explorer though.

Aelij Arbel