/    Sign up×
Community /Pin to ProfileBookmark

Help Needed with Redirect

Hi there,

I have a delayed redirect script on my page but it’s not working. I copied it from a1javascripts.com and have also tried one from another free java scripts site.

Neither of them work…

Is there any reason somebody may know of why the redirect is not working or can somebody type me out a delayed redirect script that will automatically redirect a user to another page after about 10 seconds.

Thanks,

Chris

to post a comment
JavaScript

12 Comments(s)

Copy linkTweet thisAlerts:
@CharlesMay 30.2005 — <META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://www.foo-bar.com/">
Copy linkTweet thisAlerts:
@UltimaterMay 30.2005 — <i>
</i>&lt;script type="text/javascript"&gt;
setTimeout(redir,10000)
function redir(){
location.href="http://webdesign.about.com/"
}
&lt;/script&gt;
&lt;noscript&gt;
&lt;meta http-equiv="refresh" content="10;url=http://webdesign.about.com/"&gt;
If you aren't automaticly redirrected in 10 seconds, &lt;a href="http://webdesign.about.com/&gt;click here&lt;/a&gt;
&lt;/noscript&gt;
Copy linkTweet thisAlerts:
@CharlesMay 30.2005 — From the [url=http://www.w3.org/TR/html401/sgml/dtd.html]HTML 4.01 DTD[/url]:&lt;!ENTITY % head.content "TITLE &amp; BASE?"&gt;
...
&lt;!ENTITY % head.misc "SCRIPT|STYLE|META|LINK|OBJECT" -- repeatable head elements --&gt;
...
&lt;!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head --&gt;
Which is to say, the NOSCRIPT element cannot appear in the document's HEAD.
Copy linkTweet thisAlerts:
@UltimaterMay 30.2005 — Hmm.. you're right. This shouldn't have redirrected me with JS enabled:
<i>
</i>&lt;noscript&gt;
&lt;meta http-equiv="refresh" content="10;url=http://webdesign.about.com/"&gt;
If you aren't automaticly redirrected in 10 seconds, &lt;a href="http://webdesign.about.com/&gt;click here&lt;/a&gt;
&lt;/noscript&gt;

However, the text didn't show for it got blocked correctly by the NOSCRIPT tag.

So I guess the NOSCRIPT tag cannot block the META tag ?
Copy linkTweet thisAlerts:
@UltimaterMay 30.2005 — Well, we could always do this:
<i>
</i>&lt;head&gt;
&lt;meta http-equiv="refresh" content="10;url=http://webdesign.about.com/"&gt;
&lt;script type="text/javascript"&gt;
setTimeout(redir,10000)
function redir(){
location.href="http://webdesign.about.com/"
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
If you aren't automaticly redirrected in 10 seconds, &lt;a href="http://webdesign.about.com/"&gt;click here&lt;/a&gt;
&lt;/body&gt;
Copy linkTweet thisAlerts:
@CharlesMay 30.2005 — From the HTML 4.01 DTD:&lt;!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body --&gt;Which is to say that the BODY element cannot directly contain inline elements or PCDATA. You need something more like &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta http-equiv="refresh" content="10;url=http://webdesign.about.com/"&gt;
&lt;script type="text/javascript"&gt;
setTimeout(redir,10000)
function redir(){
location.href="http://webdesign.about.com/"
}
&lt;/script&gt;
&lt;title&gt;Example&lt;/title&gt;
&lt;p&gt;If you aren't automaticly redirrected in 10 seconds, &lt;a href="http://webdesign.about.com/"&gt;click here&lt;/a&gt;&lt;/p&gt;
Copy linkTweet thisAlerts:
@UltimaterMay 30.2005 — Doesn't that lack a HTML and HEAD tag?
Copy linkTweet thisAlerts:
@CharlesMay 30.2005 — From the HTML 4.01 DTD:&lt;!ELEMENT HTML O O (%html.content;) -- document root element --&gt;
...
&lt;!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head --&gt;
...
&lt;!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body --&gt;
Which is to say that the HTML, HEAD and BODY start and end tags are all optional. It's the two Os after the element name that does it.

I suggest you read http://www.w3.org/TR/html401/ .
Copy linkTweet thisAlerts:
@UltimaterMay 30.2005 — Oh, so two Os means that the start and end tag are optional.

Then I'd assume that one O means that the end tag is optional.

*skims through a bit*

[url=http://www.w3.org/TR/html4/struct/objects.html#edef-APPLET]What! The APPLET tag is deprecated (with all its attributes) in favor of OBJECT![/url]

Geez...
Copy linkTweet thisAlerts:
@UltimaterMay 30.2005 — Does this mean you can get Java code to tun in the OBJECT tag? Idk that. *drops mouth*
Copy linkTweet thisAlerts:
@CharlesMay 30.2005 — Does this mean you can get Java code to tun in the OBJECT tag? Idk that. *drops mouth*[/QUOTE]No, it means that you're supposed to be able to use it for applets, images and inline frames. But we have to take into account MSIE. If they would only ignore the element then we could use it thusly:&lt;object data="thing-logo.png" type="image/png"&gt;Thing Corp&lt;/object&gt;But the creatons in Redland saw fit to recognize the element and make it not work.

And note what the DTD has to say about the P element:&lt;!ELEMENT P - O (%inline;)* -- paragraph --&gt;The dash means that the start tag is required.
Copy linkTweet thisAlerts:
@UltimaterMay 30.2005 — No, it means that you're supposed to be able to use it for applets, images and inline frames. But we have to take into account MSIE. If they would only ignore the element then we could use it thusly:&lt;object data="thing-logo.png" type="image/png"&gt;Thing Corp&lt;/object&gt;[/QUOTE]
I don't understand. Does this mean that Java will be halted all-together?

How can the APPLET tag be deprecated in favor of the OBJECT tag?

APPLETs are used to run Java Code. Can an OBJECT tag do that?

How can you compair the two?

If they were to erase the APPLET tag in later browsers in favor of the OBJECT tag (maybe in 10 years or so), and I write-up some Java code and wish to run it in an APPLET, which would be no longer supported, how would you go about this?
×

Success!

Help @ip81 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...