SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2010
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Coding for both js and non-js browsers

    I'm currently modifying a php controlled website and wish to distinguish between javascript and non-javascript browsers in order to decide which pages to display.
    I have a single php controller script which "includes" a number of html pages. I want to ensure that I cater for both javascript and non-javascript browsers (so functionality is the same, only the javascript pages have a far better look and feel to them).

    Therefore I would like to code something along the lines of :

    Code:
    if (javascript_browser=='true')
    {
     include './javascript_page1.html.php';
     exit();
    }
    else
    {
     include '.non_javascript_page1.html.php';
     exit();   
    }
    can anyone advise on the best way to achieve this please...

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Look into techniques of "Progressive Enhancement", where your basic non-js site is a) navigable b) readable and makes sense then you progressively add JS to enhance the experience.

    All client side dependencies such as is JS turned on happen on the client, PHP has already done its job and sent the stream of data to the client. So forget that idea now.


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
  •