Javascript Window Fun

By sarchbold ·

I am having a fun time trying to get something to work.

What I am trying to do is this.

I have Page A, Page B, and Page C

On Page A and Page B there are links that will open up a new browser window with an editable document.

I never want a user to be able to open more then one editable document window at a time.

What I require is if someone opens up a document on Page A and then brows from Page A to Page B while this document is still open and try to open up another document for editing it will stop them because it sees that a page is already open for editing.

As well if they are on page A and open a document and go to Page C then back again they will not be able to open up another editing document while the current one is still open.

And finally if they are on Page A, open up a document then try to open another one(this is currently working with the code below)

It?s a bit hard to explain but I hope the above gets the gist of it.

Currently my code looks like this:

var NewWindow;

function OpenNewWindow(mypage, myoptions){
if (!NewWindow || NewWindow.closed ){"","frmNewDoc", myoptions);
NewWindow.location.href; // throws exception if already loaded
NewWindow.location = mypage;


if(NewWindow && !NewWindow.closed) {
// already opened and not closed
alert("You may only edit one document at a time. Please close the existing window.")

Any suggestions how I can accomplish my task?


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums