Hmm the exact solution really depends upon the details of what you have already. For example, initially, will the user have to click on a link to open the DHTML window (on any page), and if so, have the same window automatically appear on subsequent pages? Assuming that's your set up, the solution would go something like the below:
Firstly, you'll want to modify the setCookie() function inside the modified .js file with the changes in red, to make sure the cookie value persist across all directories within your domain:
Code:
setCookie:function(name, value){
document.cookie = name + "=" + value+"; path=/"
},
Then, on all relevant pages of your site, install the modified DHTML window script on these pages, including the openpopup() function you have above:
Code:
<script type="text/javascript">
function openPopup(){
ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "sample.html",
"Sample Popup Window", "width=300px,height=200px,left=1px,top=1px,resize=1,scrolling=1", "recal")
ajaxwin.onclose=function(){return window.confirm("Alright to close this window?")}
if (dhtmlwindow.getCookie("ajaxbox"))
ajaxwin.moveTo(dhtmlwindow.getCookie("ajaxbox").split(" ")[0], dhtmlwindow.getCookie("ajaxbox").split(" ")[1])
}
</script>
At this point no DHTML window should pop up automatically. To get that to happen if/when a window cookie is detected, add the below script following the above:
Code:
<script type="text/javascript">
if (dhtmlwindow.getCookie("ajaxbox"))
openPopup()
</script>
That should be it, in theory anyway.
Bookmarks