Welcome to TalkGraphics.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2009
    Posts
    21

    Default Mobile website device detection code??

    Hi, it's me, Pixelart, again and doing serious hairpulling on the mobile site issues. Got the "click to call" button figured out; but now on the "device detection" code, or what is also referred to as the "redirect code", that's compatible with Xara,

    Have tried a couple of versions of Javascript inside the <head> </head> tag of the index.htm file of the classic site(as directed by some coding site references), but have tried 3 different flavors and it does not seem to be working.

    Does it maybe need to go in the ping.js or roe.js file of the classic site generated by Xara, since it is javascript? Has anyone else started doing mobile sites and have hints on this? Have a developer friend trying to help me figure this out, but we're both stumped; his suggestion that the Xara files are saved as PHP files, then use PHP code. This isn't optimum for me. Any thoughts??

    Thanks x1,000 if you can help!!
    Pixelart

  2. #2
    Join Date
    Mar 2009
    Location
    England
    Posts
    1,996

    Default Re: Mobile website device detection code??

    Have you tried this one ?

    Code:
    <script type="text/javascript">
    <!--
    if (screen.width <= 699) {
    document.location = "mobile.htm";
    }
    //-->
    </script>
    Change the screen size from 699 to something like 3000 to test in Xara
    Attached Files Attached Files

  3. #3
    Join Date
    Jun 2009
    Posts
    21

    Default Re: Mobile website device detection code??

    Hi Drwyd,

    Yes, that was the first piece of code I tried, of course, deleting the comment out code. Don't understand how changing the screen size to test in Xara would do anything; doesn't it have to be tested with a mobile device to verify if working correctly?

    Thanks for responding, really appreciate.

    Pixelart

  4. #4
    Join Date
    Mar 2009
    Location
    England
    Posts
    1,996

    Default Re: Mobile website device detection code??

    yes ideally it's best to test on a mobile device. In the absence of one the code can be tested in WD/DP by setting the triggering size to larger than your screen. With me now ?

  5. #5
    Join Date
    Jun 2009
    Posts
    21

    Default Re: Mobile website device detection code??

    Think so...kind of....

    Hi again,

    A little confused, I changed width, as you instructed, as so:

    <!--redirect to mobile web code-->

    <script type="text/javascript">

    if (screen.width <=3000) {
    document.location = "http://resumeidentity.com/mobile";
    }

    </script>

    After doing this, opened the index.htm file for the classic site in a browser and it takes me to the mobile site in the browser. Great! When I put the dimension back to "less than 699" or: if (screen.width <=699) if reverts back to desktop site. I am feeling either easily confused or stupid. I'm not showing it working on my mobile phone at all.

    Thanks for your patience! Pixelart

  6. #6

    Default Re: Mobile website device detection code??

    Is javascript enabled on your phone?

    Android: ► http://timeread.hubpages.com/hub/How...-Android-phone

  7. #7
    Join Date
    Mar 2009
    Location
    England
    Posts
    1,996

    Default Re: Mobile website device detection code??

    After doing this, opened the index.htm file for the classic site in a browser and it takes me to the mobile site in the browser. Great! When I put the dimension back to "less than 699" or: if (screen.width <=699) if reverts back to desktop site
    Which gives us proof that the code works and a working example

    The next step is then to check that the code is executed properly on the mobile device and that JS is enabled on it. (see Sledger's link)

    If this does not work on the device in its default setup then it's probably a non-starter.

    http://resumeidentity.com/mobile seems to work OK

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •