Is There A Redirect Script For This?

4 replies
Kind of a reverse mobile script, of sorts...
I'd like to be able to automatically send someone who enters one of my mobile site url's from a computer, to a page that explains it's only a mobile site. So, instead of the site looking huge on the screen, as a mobile site does on a computer screen, I would have a regular sized looking page. Maybe an ad for my mobile service.

Is there a script that detects a computer user trying to access a mobile site and sending them to a "regular" page? Hope I've explained this well enough. Thanks. Ronnie
#redirect #script
  • Hi,

    Here is a java-script I use to do just what you want I think. I use it to redirect from my mobile site to a web-page with my company info on it when some one views my mobile only page.

    <script type="text/javascript">
    <!--
    if (screen.width >= 599) {
    document.location = "";
    }
    //-->
    </script>

    Put this code in the <head> section of your mobile html code before </head? on the index page. And on any other mobile page you want to redirect from.

    remember to insert your web page location between "" in document.location

    This is a simple java redirect from mobile to standard web.

    Also - with tablets coming out width of 599 might be an issue. But there are simple work around
    for this as well.

    But for now this works..

    Hope this helps
    {{ DiscussionBoard.errors[4400207].message }}
  • Profile picture of the author Jay Moreno
    whilst detecting screen size will work for the most part if you want to be totally accurate you would really need to detect the browser type or user agent.

    If you take a look at this post:

    http://www.warriorforum.com/offline-...esolution.html

    It's not uncommon to see some mobile devices show screen resolution sizes much larger than 600px despite their small screen - which would cause incorrect redirection.

    Use whatever works best for you but just be aware of things like this.

    cheers

    jay
    Signature
    Sorry, I am too busy helping people to think of a cool signature!
    {{ DiscussionBoard.errors[4400459].message }}
    • Good point!

      Obiter Dictum
      {{ DiscussionBoard.errors[4400491].message }}
      • Profile picture of the author rlhurst
        Just got home and wanted to thank you guys for the info!
        Signature
        I do voice over work... here's a SAMPLE
        {{ DiscussionBoard.errors[4403776].message }}

Trending Topics