Lukasz
Lukasz

Reputation: 8880

Stopping JavaScript from closing a window

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.

Upvotes: 1

Views: 304

Answers (6)

BlackTigerX
BlackTigerX

Reputation: 6146

try writing another function with the same name

OpenApplicationWindow

that does nothing

Upvotes: 0

Quentin
Quentin

Reputation: 943142

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.

Upvotes: 1

Sunny Milenov
Sunny Milenov

Reputation: 22310

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.

Upvotes: 1

steamer25
steamer25

Reputation: 9538

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.

Upvotes: 1

Davis
Davis

Reputation: 317

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

Upvotes: 0

Adam Fox
Adam Fox

Reputation: 1326

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.

Upvotes: 0

Related Questions