Advanced HTML: Delayed redirect

Discuss techniques and workflows for ProtoShare.
Josh Kristof
Posts: 525
Joined: Tue Mar 31, 2009 3:40 pm

Advanced HTML: Delayed redirect

Postby Josh Kristof » Mon Jan 09, 2012 7:48 am

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>

Return to “Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest

cron