/    Sign up×
Community /Pin to ProfileBookmark

Need Javascript!

Hi!

I (badly) need a javascript that detects the screen resolution (800*600 or 1024*768) and after a specified amount of time redirects the user to one of two pages (i have a welcome site and i want the users to be redirected to one of two sites after 5 seconds). I would really apreciate if someone could mail me a script that can do that.

Benny from Sweden

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@pyroJan 19.2003 — Here you go...

<script type="text/javascript">
if (screen.width <= 800) // if less than or equal to 800x600
{
setTimeout("window.location.replace("800.htm")",5000);
}
else //everything else
{
setTimeout("window.location.replace("1024.htm")",5000);
}
</script>
Copy linkTweet thisAlerts:
@Lt__RaZieLauthorJan 20.2003 — I can't get it to work. Where do i paste it?
Copy linkTweet thisAlerts:
@CharlesJan 20.2003 — [font=georgia]Pyro made two mistakes. The first, understandable one was to forget to use two different types of quote mark. The second, inexcusable one was to neglect the fact that one in ten users do not use JavaScript. Put this script in your document's body where you want the "Continue" link to appear for those users.

[/font][font=monospace]

<script type="text/javascript">

if (screen.width <= 800) // if less than or equal to 800x600

{

setTimeout([b]'[/b]window.location.replace("800.htm")[b]'[/b],5000);

}

else //everything else

{

setTimeout([b]'[/b]window.location.replace("1024.htm")[b]'[/b],5000);

}

</script>

<noscript><p><a href="aFarFarBetterPage.html">Continue</a></p></noscript>[/font]
Copy linkTweet thisAlerts:
@pyroJan 20.2003 — First of all, thanks for noticing my quotes error... ?

[i]Origianlly posted by Charles[/i]

[B]The second, inexcusable one was to neglect the fact that one in ten users do not use JavaScript.[/B][/QUOTE]
This wasn't meant to be a full page. He asked for a script to redirect users based on resolution, so I gave it to him. I certainly wouldn't consider [B]that[/B] an error... ?
Copy linkTweet thisAlerts:
@CharlesJan 20.2003 — [i]Originally posted by pyro [/i]

[B]This wasn't meant to be a full page. He asked for a script to redirect users based on resolution, so I gave it to him. I certainly wouldn't consider [B]that[/B] an error... ? [/B][/QUOTE]
[font=georgia]Perhaps not an error but something far worse, a grievous sin.[/font]
Copy linkTweet thisAlerts:
@pyroJan 20.2003 — [i]Originally posted by Charles [/i]

[B][font=georgia]Perhaps not an error but something far worse, a grievous sin.[/font] [/B][/QUOTE]
Did you even read my last post?? I specifically said that this wasn't meant to be the complete page, simply the JavaScript necessary to perform the funtion that he asked for.

[i]Originally posted by pyro[/i]

[b]This wasn't meant to be a full page.[/b][/QUOTE]
Copy linkTweet thisAlerts:
@CharlesJan 20.2003 — [font=georgia]Yes, it was a sin of omission rather than of commission but no less injurious to Lt.RaZieL's audience or your own soul than had it been one of commission.[/font]
Copy linkTweet thisAlerts:
@pyroJan 20.2003 — [i]Originally posted by Charles [/i]

[B][font=georgia]Yes, it was a sin of omission rather than of commission but no less injurious to Lt.RaZieL's audience or your own soul than had it been one of commission.[/font] [/B][/QUOTE]
Oh my gosh...You have got to be kidding me...
Copy linkTweet thisAlerts:
@CharlesJan 20.2003 — [i]Originally posted by pyro [/i]

[B]Oh my gosh...You have got to be kidding me... [/B][/QUOTE]
[font=georgia]Well, perhaps just a little.[/font]
Copy linkTweet thisAlerts:
@pyroJan 20.2003 — I was hoping so...lol ?
×

Success!

Help @Lt__RaZieL 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,
)...