I’m working on the following script. Basically I want to redirect a page to one of two choices, based on whether the browser has allowed a popup. I know that the following won’t work because window.location needs to be called as the DOM loads, but I’m wondering if there is something I can use or if I need to rethink my approach
<script type="text/javascript">
function openwindow(){
var w = window.open("{INTERACTION}","interaction","resizable=0,width=800,height=600,status=0");
if(w){window.location = "carry on.html"};
if(!w){window.location = "blocked.html"};
}
</script>
</head>
<body>
<form>
<input type="submit" class="button" onClick="javascript: openwindow()" value="Begin" />
</form>
Thanks in advance
Giles
It isn’t necessary to call it as the DOM loads. it works both when DOM is loading and when it is fully loaded:
// during DOM loading: