/    Sign up×
Community /Pin to ProfileBookmark

A simple question – I feel stupid posting it .. can anyone help me with proper language (I’m assuming Javascript?) for automatically loading an ‘htm’ page residing locally? Based upon screen resolution, I’d like to have certain pages automatically load without the need to “click on a link.” I have the javascript code to determine screen resolution, but I’d like to automatically load the proper page associated with the screen resolution in use by the user.

Thanks …

Bruce Larrabee
[email][email protected][/email]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@JonaMay 30.2003 — [b][font=arial][color=maroon]Instead of me making a whole script for you, just post the script you have already so that I can modify it.[/color][/font]



Jona[/b]
Copy linkTweet thisAlerts:
@BLarrabeeauthorMay 30.2003 — Below is the script I have .. you can seen that I've tried a few things ... the first "if" requires clicking a link which I'd prefer not having to do ...


if (screen.height >= 768 && screen.width >= 1024) {

document.write("<a href='backtesth.htm'><img src='amb10x12.jpg'>backtest</a>");

}

else {

if (screen.height == 600 && screen.width == 800) {

document.write("default3.htm");

}

else {

document.write("<img src='amberh278.jpg' width=475 height=400 border=0>");

}

}
Copy linkTweet thisAlerts:
@JonaMay 30.2003 — [font=courier new]

<script type="text/javascript">

<!--

/*Redirection does not need an onload event, because this script is in the <head> tag, so you will automatically go to another page as soon as this Javascript is loaded--which is before the rest of the page.*/

if(screen.height >= 768 && screen.width >=1024){

location.href="large_page.htm";

} else if(screen.height == 600 && screen.width == 800){

location.href="medium_page.htm"; //this is the most common resolution

} else {

location.href="small_page.htm";

}

//-->

</script>

[/font]

[b]Jona[/b]
Copy linkTweet thisAlerts:
@pyroMay 30.2003 — Try it something like this:

if (screen.height &gt;= 768) {
window.location.href="backtesth.htm";
}
else if (screen.height == 600) {
window.location.href="default3.htm";
}
else {
document.write("&lt;img src='amberh278.jpg' width=475 height=400 border=0&gt;");
}
×

Success!

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