-
Hi, i have this external javascript. Basically i only want it to be loaded if the visitor has not seen it in the previous week.
My aim was to use a javascript cookie setter to see a cookie when the external javascript is first loaded and then check each time to see how long the visitor has not seen if for before it is loaded again.
Ok, how do i include an external javascript inside an internal javascript.
Otherwise, how could i do this using php? the pages are all php pages so that would be just fine. Is there some cookie setting code in php that could do the check and then the results send the javascript. I am new to php so any actual cookie code that would do this would be greatly appreciated.
Thanks.
-
document.write("whatever tag you use to include the external script");
Try that
-
You can't do that.
You have to include the javascript all the time and then if the specifications you want are met then call a function that starts the whole thing in the included javascript.
-
when i say include i have been using this:
(it is advertising banner)
<SCRIPT LANGUAGE="JavaScript" src="http://www.popuptraffic.com/assign.php?l=ascifi"></script>
does that work with your method wluke?
-
k, my bad ;)
sorry bout that, thought it might work
-
Ok i did it in php like this:
<?php
$check = "test";
$check .= $filename;
if ($test == $check)
{
print("<HTML><BODY>
not back yet!
</BODY></HTML>");
}
else
{
$rated = "test";
$rated .= $filename;
setcookie(test, $rated, time()+86400);
print("<HTML><BODY><SCRIPT LANGUAGE=JavaScript src=http://www.popuptraffic.com/assign.php?l=ascifi></script>
well you have been away for a bit!</BODY></HTML>");
}
?>
seems to work..
any comments on it?
-
That will work because the HTML is not processed until the javascript is inserted or not.