javascript popups
- Started
- Last post
- 23 Responses
- elwolverton
anyone know how to make a popup window load only once per browser session?
especially in conjunction with the following body tag:
- elwolverton0
[body topmargin="0" onUnload="window.open('html/disc... 'win1' ,'width=200,height=200')"]
do i need to modify the body tag, or have a script up after the document head?
- ********0
http://javascript.internet.com/g… this will make the code for you
- elwolverton0
thanks JazX,
but that generator does not specify how to make the page only show up *once*, rather than every time the page loads (or unLoads)
- ********0
just command it only open once
- elwolverton0
pardon my ignorance, but how is that done?
- mitsu0
either store a cookie on the clients machine or check session vars via server-side script to see if the page has already been visited.
- ********0
that would work
- elwolverton0
any way to do it straight from the JS code?
- elwolverton0
if not by JS, could someone direct me to a cookie-placement tutorial page?
- ********0
- mitsu0
http://www.js-examples.com/searc…
read and write
- Mick0
- elwolverton0
thanks all for your help.
sorry to be a pest, but one last question:
I have tried changing the onLoad to onUnload in the following script, but it loses all functionality. How do I make that swap?
- elwolverton0
anyone wanna take a shot at previous post?
- jpolk0
onUnload for a popup? i don't know what kinda site you're making, but i'm not helping...
- elwolverton0
i know...its the stupidest idea on planet earth. that doesnt mean that im not following through with it (not mine). i have concluded that the script works...just a little too well. it literally only loads once...and never again. *sniff* that's ok. thank you all!!!
- mitsu0
you need to run your code against this event:
onbeforeunload
- Mick0
Was the link I sent not useful?
http://javascript.internet.com/c…
You can set the number of days for the cookie - ie. so it only pops up once per day, once per 5 days, once per month , etc.
- elwolverton0
Mick,
That was very helpful, in fact.
Where in the script can I assign that expiration? I'd like it to reissue the popup every time someone revisits the site / reloads their browser.
- fuzzygroove0
jesus fuck, are you retarded?!
You want a popup to work only once per session, but every time someone revits the site?!?
THIS IS NOT LOGICALLY POSSIBLE.