redirect not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • James
    New Member
    • Jun 2011
    • 17

    redirect not working

    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


    Code:
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link rel="shortcut icon" type="image/x-icon" href="./images/favicon.ico" />
    
    <title>Home</title>
    <script type="text/javascript">
    if (screen.width<500)
    {
    window.location="http://www.jekdesign.com/mobile/mobile.html"
    }
    else
    {
    window.location="http://www.jekdesign.com/home.html"
    }
    </script>
    However doesn't seem to be working
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    screen.width gives you the width of the screen not the browser's width. you might use window.innerWid th for example.

    Comment

    Working...