Jump to content

Screen Res detection call


HalifaxPiper

Recommended Posts

I want to include a PHP file depending on the screen resolution.I do it in html using this jscript. eg.

<script language="Javascript"><!--if (screen.width > 800) {document.location = "1024.htm";}//--></script>

I need to do it in PHP not echoed to the document. fuzzy eg.

<?if (screen.width > 800) {include "1024.php";}elseinclude "800.php";

Thanks. :)

Link to comment
Share on other sites

Yeah php doesn't have access to that info, you could try something like this, javascript sends the info to a php page:Create index.htm;

<script> var width  = screen.width;var height = screen.height;window.location = 'index.php?width=' + width + '&height=' + height;</script>

and in index.php

$width = $_GET['width'];$height = $_GET['height'];if ($width> 800) {include "1024.php";}elseinclude "800.php";

Link to comment
Share on other sites

Thanks everyone for the input.My friend wanted to stay with the same frames themed site but with a database driven catalog. The resolution was needed to include PHP code based on table width.The photo album for example would show 4 thumbs across in 800 and 5 thumbs across in 1024. I took many peoples advice and pushed a single page down the SS pipe rather than a frames page. I lost the lightning loads but Meh...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...