/    Sign up×
Community /Pin to ProfileBookmark

Cookie for Browser session

Any idea how one would write a cookie routine for this code to open a window only once is a browser session? The window opens when someone clicks anywhere on the page. It could become annoying if this code is on several pages. -steve-

<script>document.onclick=function () {window.open(‘http://www.mysite.com/myfolder/index.html‘, ‘nameMe’, ‘top=5,left=35,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=1,width=600,height=555’);self.focus();}</script>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@JonaOct 27.2004 — [font=trebuchet ms]Try...[/font]

<i>
</i>&lt;script type="text/javascript"&gt;&lt;!--
if(document.cookie.indexOf("winTemp") == -1) document.onclick = function(){
window.open('http://www.mysite.com/myfolder/index.html', 'nameMe',
'top=5,left=35,toolbar=0,menubar=0,scrollbars=1,status=0,resizable=1,width=600,height=555');
self.focus();
document.cookie="winTemp=1";
}
//--&gt;&lt;/script&gt;
Copy linkTweet thisAlerts:
@stcrimauthorOct 27.2004 — That is perfect - thank you!

-steve-
Copy linkTweet thisAlerts:
@JonaOct 27.2004 — [font=trebuchet ms]Happy to help.[/font]
×

Success!

Help @stcrim spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...