Identifying Safari/webkit in HTML

Discussion in 'HTML' started by Neil Gould, Mar 16, 2011.

  1. Neil Gould

    Neil Gould Guest

    Anyone know of a reliable way to identify Safari via HTML headers? I know
    how to hack CSS to provide Safari-specific style variants, but I'd like to
    provide different content rather than styles.

    --
    Thanks,

    Neil
     
    Neil Gould, Mar 16, 2011
    #1
    1. Advertising

  2. Neil Gould

    Neil Gould Guest

    Doug Miller wrote:
    > In article <ilq8gv$742$>, "Neil Gould"
    > <> wrote:
    >> Anyone know of a reliable way to identify Safari via HTML headers?

    >
    > Nope. Any scripting language (VBScript, PHP, Perl, etc.) can provide
    > any
    > headers it damn pleases when establishing an HTTP connection --
    > there's
    > absolutely no way to tell the difference between a connection from a
    > Safari
    > browser, and a connection from a Visual Basic script that's
    > pretending to be a
    > Safari browser.
    >

    Yes, I know that one can spoof other browsers via scripts, but that is not
    of concern to what I'm trying to accomplish.

    >> I know
    >> how to hack CSS to provide Safari-specific style variants, but I'd
    >> like to provide different content rather than styles.

    >
    > Why on earth would you want to do that?
    >

    The immediate reason is to bypass the wrestling match between Apple and
    Adobe over support of flash animations. But, it would also be handy to
    redirect to a different CSS rather than hack one CSS into non-compliance.

    --
    thanks,

    Neil
     
    Neil Gould, Mar 16, 2011
    #2
    1. Advertising

  3. Neil Gould

    Doug Miller Guest

    In article <ilq8gv$742$>, "Neil Gould" <> wrote:
    >Anyone know of a reliable way to identify Safari via HTML headers?


    Nope. Any scripting language (VBScript, PHP, Perl, etc.) can provide any
    headers it damn pleases when establishing an HTTP connection -- there's
    absolutely no way to tell the difference between a connection from a Safari
    browser, and a connection from a Visual Basic script that's pretending to be a
    Safari browser.

    > I know
    >how to hack CSS to provide Safari-specific style variants, but I'd like to
    >provide different content rather than styles.


    Why on earth would you want to do that?
     
    Doug Miller, Mar 16, 2011
    #3
  4. Neil Gould

    idle Guest

    On Wed, 16 Mar 2011 08:42:30 -0500, Neil Gould wrote in alt.html:

    > Doug Miller wrote:
    >> In article <ilq8gv$742$>, "Neil Gould"
    >> <> wrote:
    >>> Anyone know of a reliable way to identify Safari via HTML headers?

    >>
    >> Nope. Any scripting language (VBScript, PHP, Perl, etc.) can provide
    >> any
    >> headers it damn pleases when establishing an HTTP connection --
    >> there's
    >> absolutely no way to tell the difference between a connection from a
    >> Safari
    >> browser, and a connection from a Visual Basic script that's
    >> pretending to be a
    >> Safari browser.
    >>

    > Yes, I know that one can spoof other browsers via scripts, but that is not
    > of concern to what I'm trying to accomplish.
    >
    >>> I know
    >>> how to hack CSS to provide Safari-specific style variants, but I'd
    >>> like to provide different content rather than styles.

    >>
    >> Why on earth would you want to do that?
    >>

    > The immediate reason is to bypass the wrestling match between Apple and
    > Adobe over support of flash animations. But, it would also be handy to
    > redirect to a different CSS rather than hack one CSS into non-compliance.


    http://net.tutsplus.com/tutorials/h...ck-tip-html-5-video-with-a-fallback-to-flash/

    http://flarevideo.com/
    http://www.longtailvideo.com/players/

    --
    idle
    I have yet to decided whether to use my power for good...or for evil.
     
    idle, Mar 16, 2011
    #4
  5. Neil Gould

    Neil Gould Guest

    idle wrote:
    > On Wed, 16 Mar 2011 08:42:30 -0500, Neil Gould wrote in alt.html:
    >
    >> Doug Miller wrote:
    >>> In article <ilq8gv$742$>, "Neil Gould"
    >>> <> wrote:
    >>>> Anyone know of a reliable way to identify Safari via HTML headers?
    >>>
    >>> Nope. Any scripting language (VBScript, PHP, Perl, etc.) can provide
    >>> any
    >>> headers it damn pleases when establishing an HTTP connection --
    >>> there's
    >>> absolutely no way to tell the difference between a connection from a
    >>> Safari
    >>> browser, and a connection from a Visual Basic script that's
    >>> pretending to be a
    >>> Safari browser.
    >>>

    >> Yes, I know that one can spoof other browsers via scripts, but that
    >> is not of concern to what I'm trying to accomplish.
    >>
    >>>> I know
    >>>> how to hack CSS to provide Safari-specific style variants, but I'd
    >>>> like to provide different content rather than styles.
    >>>
    >>> Why on earth would you want to do that?
    >>>

    >> The immediate reason is to bypass the wrestling match between Apple
    >> and Adobe over support of flash animations. But, it would also be
    >> handy to redirect to a different CSS rather than hack one CSS into
    >> non-compliance.

    >
    >

    http://net.tutsplus.com/tutorials/h...ck-tip-html-5-video-with-a-fallback-to-flash/
    >

    "Server not found"

    But, if one might glean the general idea from the text of this URL, it isn't
    really what I'm looking to do.

    --
    Thanks,

    Neil
     
    Neil Gould, Mar 16, 2011
    #5
  6. Neil Gould

    Neil Gould Guest

    Neil Gould, Mar 16, 2011
    #6
  7. Neil Gould

    cwdjrxyz Guest

    On Mar 16, 6:52 am, "Neil Gould" <> wrote:
    > Anyone know of a reliable way to identify Safari via HTML headers? I know
    > how to hack CSS to provide Safari-specific style variants, but I'd like to
    > provide different content rather than styles.


    A few years ago I needed to identify Safari to avoid a certain media
    bug it then had, now long gone. A php method seemed to work well then
    for my problem. Since this php code is free to use and distribute, I
    made a text copy of it at http://www.cwdjr.net/flash2/browdet.txt .
    The code has extensive notes by the author of it. I have not had to
    use this code for quite a while, so I do not know if it will work well
    for the most recent Safaris.
     
    cwdjrxyz, Mar 18, 2011
    #7
  8. Neil Gould

    Neil Gould Guest

    cwdjrxyz wrote:
    > On Mar 16, 6:52 am, "Neil Gould" <> wrote:
    >> Anyone know of a reliable way to identify Safari via HTML headers? I
    >> know how to hack CSS to provide Safari-specific style variants, but
    >> I'd like to provide different content rather than styles.

    >
    > A few years ago I needed to identify Safari to avoid a certain media
    > bug it then had, now long gone. A php method seemed to work well then
    > for my problem. Since this php code is free to use and distribute, I
    > made a text copy of it at http://www.cwdjr.net/flash2/browdet.txt .
    > The code has extensive notes by the author of it. I have not had to
    > use this code for quite a while, so I do not know if it will work well
    > for the most recent Safaris.

    ..
    Thanks. I was hoping this could be done in HTML to avoid having to pass
    variables to the page, but this may be the next best thing.

    --
    Neil
     
    Neil Gould, Mar 18, 2011
    #8
  9. Neil Gould

    cwdjrxyz Guest

    On Mar 18, 5:57 am, "Neil Gould" <> wrote:
    > cwdjrxyz wrote:
    > > On Mar 16, 6:52 am, "Neil Gould" <> wrote:
    > >> Anyone know of a reliable way to identify Safari via HTML headers? I
    > >> know how to hack CSS to provide Safari-specific style variants, but
    > >> I'd like to provide different content rather than styles.

    >
    > > A few years ago I needed to identify Safari to avoid a certain media
    > > bug it then had, now long gone. A php method seemed to work well then
    > > for my problem. Since this php code is free to use and distribute, I
    > > made a text copy of it athttp://www.cwdjr.net/flash2/browdet.txt.
    > > The code has extensive notes by the author of it. I have not had to
    > > use this code for quite a while, so I do not know if it will work well
    > > for the most recent Safaris.

    >
    > .
    > Thanks. I was hoping this could be done in HTML to avoid having to pass
    > variables to the page, but this may be the next best thing.


    I have a test page at http://www.cwdjr.net/flash2/DetectSafari.php and
    you will need to see http://www.cwdjr.net/flash2/DetectSafari.txt to
    view the php code. I only have the most recent Safari browser for
    Windows. On it, Safari still seems to be detected correctly. Also, the
    xhtml 1.1 page is converted to html 4.01 strict only if Safari is
    detected. Several versions of Safari back, some media would not show
    on Safari if you used true xhtml 1.1 served properly, even though
    header exchange did show that Safari would accept application/xhtml
    +xml. Thus the page was forced to be rewritten as html 4.01 strict if
    Safari was detected to force the media to show. This bug was corrected
    several versions of Safari ago.
     
    cwdjrxyz, Mar 19, 2011
    #9
  10. Neil Gould

    cwdjrxyz Guest

    On Mar 18, 7:08 pm, cwdjrxyz <> wrote:
    > On Mar 18, 5:57 am, "Neil Gould" <> wrote:
    >
    >
    >
    > > cwdjrxyz wrote:
    > > > On Mar 16, 6:52 am, "Neil Gould" <> wrote:
    > > >> Anyone know of a reliable way to identify Safari via HTML headers? I
    > > >> know how to hack CSS to provide Safari-specific style variants, but
    > > >> I'd like to provide different content rather than styles.

    >
    > > > A few years ago I needed to identify Safari to avoid a certain media
    > > > bug it then had, now long gone. A php method seemed to work well then
    > > > for my problem. Since this php code is free to use and distribute, I
    > > > made a text copy of it athttp://www.cwdjr.net/flash2/browdet.txt.
    > > > The code has extensive notes by the author of it. I have not had to
    > > > use this code for quite a while, so I do not know if it will work well
    > > > for the most recent Safaris.

    >
    > > .
    > > Thanks. I was hoping this could be done in HTML to avoid having to pass
    > > variables to the page, but this may be the next best thing.

    >
    > I have a test page athttp://www.cwdjr.net/flash2/DetectSafari.phpand
    > you will need to seehttp://www.cwdjr.net/flash2/DetectSafari.txtto
    > view the php code. I only have the most recent Safari browser for
    > Windows. On it, Safari still seems to be detected correctly. Also, the
    > xhtml 1.1 page is converted to html 4.01 strict only if Safari is
    > detected. Several versions of Safari back, some media would not show
    > on Safari if you used true xhtml 1.1 served properly, even though
    > header exchange did show that Safari would accept application/xhtml
    > +xml. Thus the page was forced to be rewritten as html 4.01 strict if
    > Safari was detected to force the media to show. This bug was corrected
    > several versions of Safari ago.


    It turns out that the browdet.php file results in false detection of
    Chrome and Flock browsers as Safari. These browsers likely were not
    used or different when this 2007 lite version of the detection php
    code was released. The same author has a complete version that has
    been greatly updated with a copyright date of Dec. 2010 . If you use
    this newer complete version of the detection php, Chrome and Flock are
    not mistaken for Safari. The new detection code is at
    http://www.cwdjr.net/flash2/browdetcomp.txt . This is used as an
    include in the example page I gave at http://www.cwdjr.net/flash2/DetectSafari.php
    with a text version at http://www.cwdjr.net/flash2/DetectSafari.txt.
    Thank goodness, the complete detection script can be used as an
    include, because it is extremely long and is likely to give you a
    headache if you study it in detail :). Browser version identification
    is very tricky, and it must be checked often as new versions of
    browsers are released. It is best to avoid it, when posible. From the
    complexity of the complete detection version given, it is apparent
    that development of browser detection code is best left to specialists
    who have much time available.
     
    cwdjrxyz, Mar 19, 2011
    #10
  11. Neil Gould

    Neil Gould Guest

    cwdjrxyz wrote:
    > On Mar 18, 7:08 pm, cwdjrxyz <> wrote:
    >> On Mar 18, 5:57 am, "Neil Gould" <> wrote:
    >>
    >>
    >>
    >>> cwdjrxyz wrote:
    >>>> On Mar 16, 6:52 am, "Neil Gould" <> wrote:
    >>>>> Anyone know of a reliable way to identify Safari via HTML
    >>>>> headers? I know how to hack CSS to provide Safari-specific style
    >>>>> variants, but I'd like to provide different content rather than
    >>>>> styles.

    >>
    >>>> A few years ago I needed to identify Safari to avoid a certain
    >>>> media bug it then had, now long gone. A php method seemed to work
    >>>> well then for my problem. Since this php code is free to use and
    >>>> distribute, I made a text copy of it
    >>>> athttp://www.cwdjr.net/flash2/browdet.txt.
    >>>> The code has extensive notes by the author of it. I have not had to
    >>>> use this code for quite a while, so I do not know if it will work
    >>>> well for the most recent Safaris.

    >>
    >>> .
    >>> Thanks. I was hoping this could be done in HTML to avoid having to
    >>> pass variables to the page, but this may be the next best thing.

    >>
    >> I have a test page athttp://www.cwdjr.net/flash2/DetectSafari.phpand
    >> you will need to seehttp://www.cwdjr.net/flash2/DetectSafari.txtto
    >> view the php code. I only have the most recent Safari browser for
    >> Windows. On it, Safari still seems to be detected correctly. Also,
    >> the xhtml 1.1 page is converted to html 4.01 strict only if Safari is
    >> detected. Several versions of Safari back, some media would not show
    >> on Safari if you used true xhtml 1.1 served properly, even though
    >> header exchange did show that Safari would accept application/xhtml
    >> +xml. Thus the page was forced to be rewritten as html 4.01 strict if
    >> Safari was detected to force the media to show. This bug was
    >> corrected several versions of Safari ago.

    >
    > It turns out that the browdet.php file results in false detection of
    > Chrome and Flock browsers as Safari. These browsers likely were not
    > used or different when this 2007 lite version of the detection php
    > code was released. The same author has a complete version that has
    > been greatly updated with a copyright date of Dec. 2010 . If you use
    > this newer complete version of the detection php, Chrome and Flock are
    > not mistaken for Safari. The new detection code is at
    > http://www.cwdjr.net/flash2/browdetcomp.txt . This is used as an
    > include in the example page I gave at
    > http://www.cwdjr.net/flash2/DetectSafari.php
    > with a text version at http://www.cwdjr.net/flash2/DetectSafari.txt.
    > Thank goodness, the complete detection script can be used as an
    > include, because it is extremely long and is likely to give you a
    > headache if you study it in detail :). Browser version identification
    > is very tricky, and it must be checked often as new versions of
    > browsers are released. It is best to avoid it, when posible. From the
    > complexity of the complete detection version given, it is apparent
    > that development of browser detection code is best left to specialists
    > who have much time available.
    >

    I fully agree with your assessment, which is why I'd prefer to avoid it.

    Thanks again for your help on this.

    --
    best regards,

    Neil
     
    Neil Gould, Mar 19, 2011
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mital
    Replies:
    0
    Views:
    267
    Mital
    Oct 26, 2008
  2. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    475
    Luke Kenneth Casson Leighton
    Dec 31, 2008
  3. PyQt4 + WebKit

    , May 30, 2009, in forum: Python
    Replies:
    5
    Views:
    1,004
    David Boddie
    Jun 5, 2009
  4. Luke Kenneth Casson Leighton

    [ANN] pywebkit - python bindings for webkit DOM (alpha)

    Luke Kenneth Casson Leighton, Oct 6, 2010, in forum: Python
    Replies:
    0
    Views:
    372
    Luke Kenneth Casson Leighton
    Oct 6, 2010
  5. Jorge
    Replies:
    10
    Views:
    387
    Thomas 'PointedEars' Lahn
    Sep 7, 2008
Loading...

Share This Page