tags:

views:

145

answers:

6

My company is required to use an application developed in ASP.NET by another company. The application needs to be open in two separate browser windows. The company that developed the application has added some JavaScript at the top of the main page to stop user from opening multiple instances of the application. The script that is placed at the top of the main page is as follows:

<script type="text/javascript">
  function OpenApplicationWindow() {
    var sessionId = 'sidus455bjzspf55cunqrv55';
    if (window.name.search(sessionId) == -1) {
        window.open(window.location.href, sessionId, "resizable=yes,scrollbars=yes,toolbar=no,status=yes");
      window.open('', '_parent', '');
      window.close();
    }
  }
  OpenApplicationWindow();
</script>

Is there anyway to open a link to that page and allow more than one instance to open? Or is there anyway to stop that script from running.

A: 

The script that is stopping you opening another window is the 2nd parameter to the window.open which is sessionid

It is checking that a window does not exist with that name already before opening it again.

Not sure if thats what youre really asking or not tho.

Adam Fox
Sorry, I understand why/how it is stopping me from opening two windows. What I am asking is how to open multiple windows anyways.
Lukasz
+1  A: 

Short of disabling JavaScript (which would probably cause other problems), the only thing I can think of is to write a small proxy to strip that stuff out.

If you only need this on a few workstations, you could use Fiddler with the script editor to inspect and modify the response.

http://www.fiddler2.com/Fiddler2/version.asp -- download Fiddler
http://www.fiddler2.com/fiddler/FSE.asp -- download the script editor.
http://www.fiddler2.com/Fiddler/Dev/ScriptSamples.asp -- see the example on this page to remove all div tags.

steamer25
Can you point me to some source on how to do something like that?
Lukasz
See if the links above help. Basically, your goal is to replace 'OpenApplicationWindow();' with an empty string when it is contained in the body of pages from the vendor. If you need it on more than a few workstations, you'll probably want something a little more transparent like a Windows service.
steamer25
A: 

If you are using Firefox you can code a greasemonkey script to override the JavaScript function.

Iuvat
Our organization is only allowed to use IE. I know it's not my idea, I just have to live with it... Note: The reason that we can only use IE is because our boss requires all the employees to run our Intranet on the Active Desktop in Windows XP. When we move to Vista or 7 he will probably make us code active desktop for the new OS? lol
Lukasz
+1  A: 

You can use GreaseMonkey for IE, and create a small custom script to overwrite or remove the offending script.

More information about using greasemonkey scripts in IE.

Sunny
It has to be a solution that does not require deployment of any software.
Lukasz
+1  A: 

I suspect that the application attempts to block having multiple windows open at the same time to prevent race conditions caused by having two interfaces operating on the same session.

If you could have two windows open at once, it would probably break.

The simplest work around would be to run two separate browsers. Each one would get its own session and they wouldn't interfere with each other.

David Dorward
It's really strange when you run the url in the first browser it opens a new window and closes the browser window I used to run the url. When I open another browser window run the url it opens the new window but it gets closed and the browser window that run the url also gets closed. So you end up with a single window.
Lukasz
A: 

try writing another function with the same name

OpenApplicationWindow

that does nothing

BlackTigerX