By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,575 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,575 IT Pros & Developers. It's quick & easy.

redirect not working

P: 17
Hi guys.

I'm trying to redirect a page depending on the user's width dimension of the browser so I can display an html page created using jQuery mobile to be viewed on an iphone, and then the original page for the web


Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  3. <meta http-equiv="Content-Style-Type" content="text/css" />
  4. <link rel="shortcut icon" type="image/x-icon" href="./images/favicon.ico" />
  5.  
  6. <title>Home</title>
  7. <script type="text/javascript">
  8. if (screen.width<500)
  9. {
  10. window.location="http://www.jekdesign.com/mobile/mobile.html"
  11. }
  12. else
  13. {
  14. window.location="http://www.jekdesign.com/home.html"
  15. }
  16. </script>
  17.  
However doesn't seem to be working
Dec 24 '11 #1

✓ answered by gits

screen.width gives you the width of the screen not the browser's width. you might use window.innerWidth for example.

Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,390
screen.width gives you the width of the screen not the browser's width. you might use window.innerWidth for example.
Jan 2 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.