Results 1 to 9 of 9

Thread: Question about browsers and javascript

  1. #1
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Question about browsers and javascript

    Hello Guys,

    I am no expert in javascript - quite the opposite. But perhaps there is someone on this forum who can help me out . I create websites for restaurant online ordering. The online ordering system is pretty unique in that it actually makes no use of javascript. This way customers who have javascript blockers on their browsers (e.g. large companies) can still order through our system.

    However I am very aware of the benefits of javascript in improving our product. Does anyone know if it is possible to detect whether a browser is blocking javascript and then direct the user to a particular page depending on the response. I have NO IDEA if this kind of thing is at all possible, but I wanted to ask.

    Thanks and enjoy your day!

    Richard

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

    Default

    It's possible, but unwieldy. A much better solution is to build a single page that makes use of Javascript in such a way that if Javascript is disabled, the page can still be used.
    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!

  3. #3
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your reply. I'm not sure how to go about doing what you suggest - but it sounds a logical thing to try. I want to have a calendar on my page that customers can select a date from. If the customer is blocking javascript, I want to be able to have them select a date from a drop down menu.

  4. #4
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    <noscript>
    stuff that replaces js, like the form elements...
    </noscript>
    The form elements wont be included and will be hidden when JS is turned on, and the opposite when JS is turned off.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  5. #5
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, that's useful!

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

    Default

    The other (less intrusive) method is to have the <select> by default, then have a script on the page hide the <select> and display the calendar instead.
    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!

  7. #7
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I like both suggestions, but I don't know enough about scripts to know how to hide the <select> tag.

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

    Default

    There's a nice tutorial over at www.howtocreate.co.uk.
    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!

  9. #9
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by boxxertrumps View Post
    <noscript>
    stuff that replaces js, like the form elements...
    </noscript>
    The form elements wont be included and will be hidden when JS is turned on, and the opposite when JS is turned off.
    And you're screwed if scripting support is enabled (and it doesn't even have to be javascript!) yet the user agent is not capable of executing the script properly. This is why the noscript element is a waste of time. Follow Twey's suggestion: dynamically modify the page via scripting.

    Mike

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
  •