Re: Get Resolution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hii there,

You can use Javascript to detect screen resolution and then change the page matching to screen size

here is the script i searched from google.
http://www.pageresource.com/jscript/jscreen.htm


and one from downloaded from some other site.



--------------------------------------------------------------------------------

<!-- ONE STEP TO INSTALL RESOLUTION REDIRECT:

  1.  Copy the coding into the HEAD of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<script type="text/javascript">
<!-- Begin
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: fjhdehoog :: http://members.home.nl/fjhdehoog */

var thiswidth=screen.width;
var thisheight=screen.height;

// file to load if resolution is 640x480:
var if640x480 ="index640x480.html";

// file to load if resolution is 800x600:
var if800x600="index800x600.html";

// file to load if resolution is 1024x768:
var if1024x768="index1024x768.html";

// file to load if resolution is 1152x864:
var if1152x864="index1152x864.html";

// file to load if resolution is 1280x720:
var if1280x720="index1280x720.html";

// file to load if resolution is greater than 1280x720:
var Redirect ="http://www.google.com";;

var msg="Sorry my page cannot be viewed with current resolution.\nCurrent Resolution : "+ thiswidth +' x '+thisheight+"\nTip Set your resolution to 800 x 600.\nRedirecting to google.com";
location=(Redirect);

// Do not change anything below this line
// --------------------------------------
var width1 = 640; var height1 = 480;
var width2 = 800; var height2 = 600;
var width3 = 1024; var height3 = 768;
var width4 = 1152; var height4 = 864;
var width5 = 1280; var height5 = 720;

if (screen.width == width1 || screen.height == height1){
  location=(if640x480);}
else if(screen.width == width2 || screen.height == height2){
  location=(if800x600);}
else if(screen.width == width3 || screen.height == height3){
  location=(if1024x768);}
else if(screen.width == width4 || screen.height == height4){
  location=(if1152x864);}
else if(screen.width == width5 || screen.height == height5){
  location=(if1280x720);}
else if(screen.width >= width5 || screen.height >= height5){
  alert(msg);
}
//-->
</script>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com";>The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  2.05 KB -->

--------------------------------------------------------------------------------

Regards,


Tarun
http://www.business-times.net/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux