Results 1 to 6 of 6

Thread: Browser detection help

  1. #1
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Browser detection help

    Hello, i am totally new to javascript and i want to know how to get this thing done in java, the question is how to write a piece of code depending on what browser is the client using like:

    if IE6{
    code A
    }
    else(){
    code B
    }

    then in the html corrosponding div there's document.write()

    Thanks in advance

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    what are you trying to perform that would require different browsers?

    technically speaking it is generally advisable to display the same thing to all browsers.

  3. #3
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for your reply boogyman, well technically i used a "modified" html code to embed flash without affecting the XHTML standards, the problem is when add the code for getting rid of "click to activate" thingy it still work in FF and Opera, but not in IE.. it makes IE crashes.

    So, since the part of the original flash embeding code which is not XTHML standard is this part :
    <embed>...</embed>

    so i can still use the normal flash code when the browser is IE, and if not IE, the code will be the modified one.

    Thanks

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

    Default

    The usual method of embedding Flash is one popularised under the name Flash Satay. However, it's very likely that you shouldn't be using XHTML at all (and that in fact you aren't right now, even if you think you are) — IE does not support it. Try reading http://www.webdevout.net/articles/beware-of-xhtml.
    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!

  5. #5
    Join Date
    Aug 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    [QUOTE=Twey;158559]The usual method of embedding Flash is one popularised under the name Flash Satay. QUOTE]

    First of all thank you for answering.. well it's something like Flash Satay, it just uses a faked gif instead of a swf.. let me show you the code:

    <object type="application/x-shockwave-flash" data="Movie1.swf" width="760" height="350">
    <param name="movie" value="Movie1.swf" />
    <param name="wmode" value="transparent" />
    <param name="menu" value="false" />
    <img src="banner.gif" width="760" height="250" />
    </object>

    it works very well in all browsers (Including IE), the problem is when i add the js code that will remove the dotted rectangle (click to activate), IE crashes, while it works fine in FF, Safari and Opera.

    One more thing.. it may be true that IE doesn't support XHTML, However it's validated as XHTML and LOOKS the way i want it to look like in IE as well.

    Thanks

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

    Default

    One more thing.. it may be true that IE doesn't support XHTML, However it's validated as XHTML and LOOKS the way i want it to look like in IE as well.
    It's not really valid. The validator thinks it's valid, but the validator determines whether to use HTML or XHTML by the DOCTYPE provided. Browsers don't: they judge by the Content-Type header that your server sends. If you can view the page in IE, that means that that Content-Type header is text/html.

    In other words, you're actually serving broken HTML to the clients that matter. There is no advantage and a fair few disadvantages as compared to serving correct, strict HTML.
    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
  •