Results 1 to 3 of 3

Thread: html4/html5 browser redirect

  1. #1
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default html4/html5 browser redirect

    Greetings all

    I am pretty newbie to web page dev.

    ../html4/ folder contains html4 compatible web pages
    ../html5/ folder contains html5 compatible web pages

    index.html detects the browser type and redirect page to either html4 or html5

    now need to stop users keep moving it manually between these folders

    example IE6 browser person types domainname.com/html5/index.html and say's the webpage is not getting displayed.

    i tried keepig the following script in individual pages, but it goes in on loop


    index.html

    <script language="JavaScript"
    type="text/JavaScript">
    if(navigator.appName == "WebTV")
    {
    window.location = "www.domainname.com/html4/index.html"
    }
    if(navigator.appName == "Netscape")
    {
    window.location = "www.domainname.com/html5/index.html"
    }
    if(navigator.appName == "Safari")
    {
    window.location = "www.domainname.com/html5/index.html"
    }
    if(navigator.appName == "Opera")
    {
    window.location = "www.domainname.com/html4/index.html"
    }

    if(navigator.appName == "Microsoft Internet Explorer")
    {
    window.location = "www.domainname.com/html4/index.html"
    }
    window.location == "Other.html"
    </script>
    -->

    aboutus.html

    <script language="JavaScript"
    type="text/JavaScript">
    if(navigator.appName == "WebTV")
    {
    window.location = "www.domainname.com/html4/aboutus.html"
    }
    if(navigator.appName == "Netscape")
    {
    window.location = "www.domainname.com/html5/aboutus.html"
    }
    if(navigator.appName == "Safari")
    {
    window.location = "www.domainname.com/html5/aboutus.html"
    }
    if(navigator.appName == "Opera")
    {
    window.location = "www.domainname.com/html4/aboutus.html"
    }

    if(navigator.appName == "Microsoft Internet Explorer")
    {
    window.location = "www.domainname.com/html4/aboutus.html"
    }
    window.location == "www.domainame.com/html4/aboutus.html"
    </script>
    -->


    contactus.html

    <script language="JavaScript"
    type="text/JavaScript">
    if(navigator.appName == "WebTV")
    {
    window.location = "www.domainname.com/html4/contactus.html"
    }
    if(navigator.appName == "Netscape")
    {
    window.location = "www.domainname.com/html5/contactus.html"
    }
    if(navigator.appName == "Safari")
    {
    window.location = "www.domainname.com/html5/contactus.html"
    }
    if(navigator.appName == "Opera")
    {
    window.location = "www.domainname.com/html4/contactus.html"
    }

    if(navigator.appName == "Microsoft Internet Explorer")
    {
    window.location = "www.domainname.com/html4/contactus.html"
    }
    window.location == "www.domainame.com/html4/contactus.html"
    </script>
    -->

    can any one of you help me pls?

  2. #2
    Join Date
    Feb 2008
    Posts
    81
    Thanks
    8
    Thanked 5 Times in 5 Posts

    Default

    You will need to put that script in each and every page, including the /html4 files and /html5 files.

    This method of doing it is not very elegant. As you can see you have to make separate pages for every single page you want to display, and additionally the extra js on each of those pages.

    Instead, just make changes in your css, specific for certain browsers. Some features, work on all browsers, so try making your webpage as cross-compatible as possible, and for additional features, seperate css and script would be required

  3. #3
    Join Date
    May 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    very nice of you midhul

    honestly i dont know how to do this, even though my browser is firefox 4, after keeping this script in all the .html files related to html5 folder, while accessing it, the browser looks empty and keep saying connecting.

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
  •