Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
This little script make popup only appear once, but need little edit
Old 07-17-2009, 10:40 AM This little script make popup only appear once, but need little edit
Skilled Talker

Posts: 69
Name: syu
Trades: 0
Hi guys

below script is working to make popup only appear once in our website, but maybe its need some edit/fix



For example its working
first, user go to www.yourdomain.com/01/01/2009/title/ page -> then the popup appear
then the user go to www.yourdomain.com/01/01/2009/title/2.html page -> the popup NOT appear, so the script is working to make popup only appear once


but its not working if the user go to another path/folder, for example
first, user go to www.yourdomain.com/01/01/2009/title/ page -> then the popup appear
then the user go to www.yourdomain.com/01/01/2009/title2/ page -> the popup APPEAR AGAIN, so the script is not working if the path/folder different, still in same domain




this script is from here









Quote:
<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}

function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}

function pop()
{
theUrl = "http://www.yahoo.com";
window.open(theUrl,"theWindow","width=400,height=4 00,menubar=yes,toolbar=yes")
}

var seen = getCookie("seen");

if (!seen) {
var now = new Date();
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
setCookie("seen", 1, now);
pop();
}

//-->
</script>
</head>
<body>
blah
</body>
</html>





i had try removing the part in red above or only one of them, but its still appear if change to other path/folder, still in same domain, please help to fix it guys not appear again in entire yourdomain.com, whatever the path is

or if you have other script to make popup only appear once for each user, its good if you share it too guys
__________________
Lets help each other

Last edited by basketmen; 07-17-2009 at 10:59 AM..
basketmen is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-17-2009, 01:19 PM Re: This little script make popup only appear once, but need little edit
Novice Talker

Posts: 12
Name: Sean Greg
Trades: 0
Is this for advertisements? or just hosting that have pop-ups.
__________________

Please login or register to view this content. Registration is FREE
/
Please login or register to view this content. Registration is FREE

ITVower is offline
Reply With Quote
View Public Profile
 
Old 07-17-2009, 01:46 PM Re: This little script make popup only appear once, but need little edit
orionoreo's Avatar
Ultra Talker

Posts: 335
Name: Jerry
Trades: 0
i know nothing of javascript... so you've posted in the wrong place

but if I were to do it in php I would use a cookie or session to note that the user has viewed the popup already
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
orionoreo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to This little script make popup only appear once, but need little edit
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28679 seconds with 12 queries