|
Cool Redirect
XML Menu Builder
Build powerful, client-side DHTML menus using XML for data and CSS for style. No JavaScript data! No having to place list elements on every single page of your website! No plug-ins!
Cool Redirect is a JavaScript script that allows you to easily set up a web page redirector that displays a graphical countdown of the seconds to go before the web page is redirected. No web server is required to run Cool Redirect. It is portable, light-weight, highly configurable, supports foreign languages, and best of all, it's free! Browser Compatibility
View Cool Redirect Demos Download Cool Redirect Script and Demos Download cool_redirect.zip Configuration Instructions Step 1 Download the file cool_redirect.zip to your computer. cool_redirect.zip contains the following files: coolRedirect.js Step 2 Unzip cool_redirect.zip. Create an HTML file in the same directory as the one you just unzipped the contents of cool_redirect.zip. We will refer to this HTML file as the Target Page. Instead of creating a new Target Page, you can use a preexisting HTML file. Open the Target Page in an editor and place the following script tag pair between the opening and closing <head></head> tags: <script src="coolRedirect.js" type="text/javascript"></script>Step 3 Replace the opening body tag of the Target Page with the following: <body onload="coolRedirect('http://codehouse.com')">This will redirect the Target Page to the CodeHouse.com home page. Read the next step to learn how to redirect the Target Page to the URL of your choice. Step 4 In the code above, replace the text in single quotes with the URL you want the Target Page redirected to. For example, if you were Bill Gates and you wanted your page redirected to the Microsoft Home Page, your opening body tag would look as follows: <body onload="coolRedirect('http://microsoft.com')"> Step 5 Designate which tag on your Target Page will display
digits when the countdown timer is counting down. You do this by assigning
the id attribute of the tag to COOL_REDIRECT.
In the demo1.htm example we designated the following tag to display countdown digits by setting the id attribute of the tag to COOL_REDIRECT as follows: <div class="counter" id="COOL_REDIRECT">12</div>We didn't have to use a div tag. We could have used a span tag as we did in demo2.htm, or any other tag type that can contain text in between its opening and closing tags. Step 6 Determine the number of seconds you want to count down before the page is redirected and place this number between the tag pair where you want to have countdown digits displayed. The tag type that you designate to have Cool Redirect display countdown digits must have a positive integer in between its opening and closing tag. Do not place letters or non-numeric characters between the tag pair or the program won't function properly. Notice in the div tag above, in Step 5, we designated that the countdown timer start counting down at 12 seconds. Step 7 This is an optional step that involves setting the format of the digits displayed during the countdown. It has nothing to do with the operation of Cool Redirect. Cool Redirect renders digits in the format specified by your HTML code. In both demo1.htm and demo2.htm we controlled the font size and color of the text by creating a Style Sheet class called counter in the style tag and assigning it to the class attribute of the div tag, as seen above in Step 5. Step 8 This is an optional step. It is applicable to people who want to provide foreign language support or want to customize the default look of Cool Redirect. After the countdown timer has finished counting down, by default Cool Redirect displays the text: "Redirecting..." while the page is being redirected. You can change this text by adding it as a string to the second parameter of the coolRedirect function in the onload handler of the body tag. In the example below, we change Cool Redirect's default text to "Redirecting to CodeHouse.com..." <body onload='coolRedirect("http://codehouse.com", "Redirecting to CodeHouse.com...")'> Note that the text of the second parameter to the coolRedirect function replaces the existing HTML inside the opening and closing body tags of the document. Because you are adding HTML code to the page, you are free to supply an HTML tag. For example, the following code places our custom message 50 pixels below the top margin of the page. <body onload='coolRedirect("http://codehouse.com", "<div style=\"margin-top: 50px\">\ Redirecting to CodeHouse.com...</div>")'> Also keep in mind that since you are adding HTML, it must be valid HTML. Step 9 Upload the Target Page and coolRedirect.js to your website, and place them in the same directory. |