Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: looking to scan browser and redirect to it's site

  1. #1
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question looking to scan browser and redirect to it's site

    Hello there,

    I hope someone can help me.
    I'm looking for a script to put in my index-file that looks at the browser of the visitor of my site and redirect it to the correct site.

    I'm traying to create different websites for netscape, IE and firefox for systems as PDA, desktop and Mac.

    Is there a script that can do all that??

    Thanks for helping me out!
    Greetingz from the Netherlands!
    Mike

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    First of all, Netscape and Firefox have the same appName.

    Code:
    <script>
    var netscape="http://whatever.com"
    var ie="http://whatever.com"
    if (navigator.appName=="Netscape") {window.location.href=netscape}
    if (navigator.appName=="Microsoft Internet Explorer") {window.location.href=ie}
    </script>
    Twey told me before that this was a bad idea, so take his advice.
    Last edited by mburt; 08-01-2006 at 04:16 PM.
    - Mike

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It is... a very bad idea. Redirecting for small screens (such as those seen on mobile devices) is also a pretty bad idea, but somewhat better since occasionally there genuinely is no other way to do it (such as with mobile browsers that support only cHTML). However, these browsers tend not to support Javascript either. You should use a server-side script to check the user agent and redirect based on that.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    I agree.
    - Mike

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    In fact, checking the Accept: header would be even better, if cHTML has a designated MIME-type.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    How would you read the browser on a mobile device, if you can't use JavaScript?
    - Mike

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I repeat:
    Quote Originally Posted by myself
    However, these browsers tend not to support Javascript either. You should use a server-side script to check the user agent and redirect based on that.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Mesa stupid.
    - Mike

  9. #9
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Thanks for your respons!
    Great to read that questions posted in this forum are answert!!!
    (I've posted this question at other forums over a month now but no reaction!
    Here...THE SAME DAY!!!!!!! WOW!!! )

    Ill try the script out!
    Yesterday after posting here I found this script:

    <script>
    if(navigator.userAgent.indexOf("PPC")!=
    -1){top.location.href='http://pda.whatever.com';}
    </script>

    But I have now experians with java-programming so I have no idea what it does or how to use it. Or even if it is any good!

    Can someone explain it a bit to me?

    Thanks!
    Greetz From the Netherlands
    Mike W.

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    That's not Java, it's Javascript.

    It's not good. Not good at all. You should follow my suggestion above.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •