Set cookie to break a loop

I have a javascript that resizes the window by opening a new and closing the old behind. This is operated with a button. Another button on the new page de-resizes the window. So far so good, but i don't want the browser to be able to resize it again (since this closes the actual browser window). So... what i want to do is to set a cookie that detects if the browser already has been to the page, and if so force the browser to skip the javascript. I imagine that this is done with a simple if/then... but how?

The whole setup is available at: http://www.gp.se/dagl/frames/resize

nyheter9.html loads right.html which has the resize-javascript which launches nyheter10.html that loads right2.html that contains the de-resize-javascript. I want the loop to end there.
Best,
Algabatz
LVL 1
algabatzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

garikCommented:
Could you clarify where the loop should end? Is it right.html with resize-javascript you don't want to run a second time?
0
RM032397Commented:
if you work on a window you should be able to find the window.name

When you say 're-size' I take it that you open a new window and put the page into it.

If the window.name is one you do not want to resize then an 'if' clause based on that will do the trick. No need for cookie.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
algabatzAuthor Commented:
Thanks, both of you! Well Garic is correct, i don't wish for the "right.html"- javascript to run a second time. How do i prevent this?
0
RM032397Commented:
Your file opens in a window, the name of which you have no control over.

You re-open it in a sized window, named to your specification.

The closing script will run in _your_ named window and in no other.

Here is a real bit of code from one of my demos. This one opens the smae file in a different frame, and only when there gest data from its counterpart.

function getvalues(){ //alert(self.window.name)
if (self.window.name=="HIDING")
{for (var x=0 ; x<6 ; x++)  // allow for hidden fields!
{window.document.forms[0].elements[x].value=parent.MAIN.document.forms[0].elements[x].value};
parent.MAIN.location="cic.htm"
window.document.forms[0].submit()
}
}

0
algabatzAuthor Commented:
Thanks, this service is so great! I'll be back...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.