Page 1 of 1

Advanced HTML: Delayed redirect

Posted: Mon Jan 09, 2012 7:48 am
by Josh Kristof
Below is code that can be used in an advanced HTML component to allow for a page to automatically redirect you to another. This could be used to simulate an interstitial page showing process status. The variable url contains the url of the target page.

Code: Select all

<!DOCTYPE html>
<html>
<head><title></title>
<script type="text/javascript">

var url = "/wa/page?oid=1008684";
var delay = 9.0;

function go() {
if ( isEditing() ) {
console.debug("skipping redirect to: " + url + " (editing)" );
return;
}

try {
window.parent.site9.open( url );
}
catch ( e ) {
window.parent.location = url;
}
}

function isEditing() {
try {
if ( window.parent.frameElement.s9_workspace ) {
return true;
}
}
catch ( e ) {
}

return false;
}
</script>
</head>
<body onload="setTimeout( go, delay * 1000 );" style="background:transparent">
</body>
</html>