Can somebody write some Javascript for me?

Discussion in 'Web Design and Development' started by MorphingDragon, Apr 19, 2010.

  1. MorphingDragon macrumors 603

    MorphingDragon

    Joined:
    Mar 27, 2009
    Location:
    The World Inbetween
    #1
    :eek: I know a little Javascript but not enough for what I want to do.

    I have a client who wants a website to support all the way back to IE6, but he also wants some features only avaliable in CSS, which don't work properly in IE6. (Yes Ive tried the workarounds I know)

    I had an idea where there are two versions of the website. One in 'old code' which works with IE6/7 and a modern one.

    I guess what I'm asking is a piece of Javascript that runs as soon as the HTML file is loaded, ckecks to see if they're running IE6/7 then redirects the user to the new website root.

    The modern one is stored simply at the website root, and the IE6/7 compat. one is 'ieold/index2.html'
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
  3. 7on macrumors 601

    7on

    Joined:
    Nov 9, 2003
    Location:
    Dress Rosa
    #3
    I would try and do the browser redirect in PHP if possible (less load on the client).

    Also what features is he wanting? You could easily do shadows, rounded corners, etc as images.

    Also, with a strict doctype IE7 should render pretty closely to standard browsers. You just gotta watch white space bugs and z-index bugs.

    If a client of mine wanted an IE6 compatible site I'd probably slice it into tables and just pull the content in with PHP includes.
     
  4. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #4
    If you find the only differences necessary are CSS related, and noting anyone can disable Javascript and break your site, consider using the MSIE conditional CSS hack or the use of !important in your style attributes.

    Details about the the CSS hack method are found here.
    Details about the use of !important are found here.

    Example CSS hack in your HTML:

    HTML:
    <!--[if IE 6]>
    Special instructions for IE 6 here -- i.e. load a different stylesheet
    <![endif]-->
    
    Example of !important for special styling for MSIE6 or lower:

    HTML:
    p {
       background: green !important; /* Major browsers other than IE 6 and below respect the importance immediately */
       background: red; /* IE 6 and below use this value instead, even though the above was marked as important */
    }
    
    And finally, consider calling reset.css before any other styles which helps with common cross-browser CSS problems including this one. Plenty versions out there.

    -jim
     

Share This Page