views:

122

answers:

2

We are trying to do a loose-integration of our product with another in the company. Ours has both a windows and web client, theirs is entirely on the web. In short they've made a landing page for us that accepts some parameters and we simply make a GET to that URL to transition the user into the other application.

There are issues in the other application with session state, and opening multiple browsers causes the key for saving back to our application to be overwritten in session. I know in the web version it's a piece of cake:

window.open('http://theotherappsurl.com', 'otherapp');

By passing the window name parameter it always opens in the same tab/window.

The tricky issue is in the winforms application all I'm doing is launching the default browser to the URL:

Process.Start('http://theotherappsurl.com');

Which brings me to my question - is there any way to target existing instances of a browser window when launching it from winforms? Is there a way to name the windows this way? Anything specific to IE (I'm not a supporter of this, but our product is windows/IE-only)?

A: 

I don't know if you'd consider this overkill, but you could create a simple winform app that wraps a web browser control, make it a single instance app, and call this instead of calling IE directly.

Rich
A: 

It's almost disgusting that the following worked - have a static instance of a WebBrowser control and kick HTML to it that does a window.open() with the named window. It works the same as doing it from in an existing browser instance...doesn't even need to part of the control tree!

So now in addition to 'targeting' a browser window (something we didn't think would even be possible) my boss wants it to also bring that browser instance forward. I changed window.open(...) to window.open(...).focus() and it works on my machine (Server 2008 x64/IE8), but apparently not on his (XP/IE7). Any chance of either finding a solution or a concrete reason why?

John Clayton