WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
5906
webkit.org should explain how to detect the latest nightly
https://bugs.webkit.org/show_bug.cgi?id=5906
Summary
webkit.org should explain how to detect the latest nightly
Eric Seidel (no email)
Reported
2005-12-01 10:22:48 PST
webkit.opendarwin.org should explain how to detect the latest nightly Some web authors would like to be able to detect that clients are running a more recent version of Safari whereby certain bugs they care about are fixed. It would be great if we could outline a sancioned method for this on webkit.opendarwin.org.
Attachments
js library
(1.70 KB, patch)
2007-01-06 16:10 PST
,
Geoffrey Garen
no flags
Details
Formatted Diff
Diff
sample code
(961 bytes, patch)
2007-01-06 16:10 PST
,
Geoffrey Garen
darin
: review-
Details
Formatted Diff
Diff
js library
(1.95 KB, patch)
2007-01-06 16:19 PST
,
Geoffrey Garen
darin
: review-
Details
Formatted Diff
Diff
sample code
(949 bytes, patch)
2007-01-07 12:29 PST
,
Geoffrey Garen
darin
: review+
Details
Formatted Diff
Diff
js library
(2.30 KB, patch)
2007-01-07 12:30 PST
,
Geoffrey Garen
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Justin Haygood
Comment 1
2005-12-29 09:15:57 PST
(In reply to
comment #0
)
> webkit.opendarwin.org should explain how to detect the latest nightly > > Some web authors would like to be able to detect that clients are running a
more recent version of Safari
> whereby certain bugs they care about are fixed. It would be great if we could
outline a sancioned method
> for this on webkit.opendarwin.org.
A system much like Gecko could be useful Gecko uses Gecko/builddate. Where I work at (an online advertisement firm), we use this heavily to work around some bugs. Maybe the versioning of WebKit can include its builddate AppleWebKit/Version.SubVersion.buildDate Sits can assume the lack of such a Date means an official release. Like today for instance: AppleWebKit/Version.SubVersion.build20051229
Mark Rowe (bdash)
Comment 2
2006-06-26 19:48:33 PDT
One issue with changing the user-agent string in this fashion is that it has the potential to break sites that alread parse the user-agent for version information. It is definitely desirable to be able to detect the SVN revision or similar, but it should be done in such a way that it doesn't interact negatively with existing functionality.
Geoffrey Garen
Comment 3
2007-01-06 14:15:56 PST
Build date seems like a crazy idea to me. We don't want websites to write custom behavior for versions of WebKit that never ship.
Geoffrey Garen
Comment 4
2007-01-06 15:56:49 PST
There some code for this on the Wiki @
http://trac.webkit.org/projects/webkit/wiki/DetectingWebKit
.
Geoffrey Garen
Comment 5
2007-01-06 16:10:12 PST
Created
attachment 12266
[details]
js library
Geoffrey Garen
Comment 6
2007-01-06 16:10:52 PST
Created
attachment 12267
[details]
sample code
Geoffrey Garen
Comment 7
2007-01-06 16:19:22 PST
Created
attachment 12268
[details]
js library I attached the wrong version. Oops.
Geoffrey Garen
Comment 8
2007-01-06 16:19:58 PST
The code I've attached has a number of advantages over the code currently on trac, including proper namespacing, ability to handle dotted minor revision numbers, independent convenience functions separated by, well, function, and more clear naming and documentation at the API level.
Darin Adler
Comment 9
2007-01-06 16:51:10 PST
Comment on
attachment 12268
[details]
js library I don't think that "AppleWebKit" is the right string to search for. I suggest searching for " AppleWebKit/" instead. I suggest breaking the version number string into a list separated by "." rather than using floating point. The version would be an array of integers. A good function would be one that compares two period-separated numbers by searching through each of them a period time. That's how I'd like to compare version numbers.
Darin Adler
Comment 10
2007-01-06 17:05:23 PST
Comment on
attachment 12267
[details]
sample code log("You browser " + (isWebKit ? "uses " : "does not use ") + "WebKit.\n"); Typo here "You" instead of "Your". I'd like versionIsAtLeast to take a string parameter instead of two integers.
Geoffrey Garen
Comment 11
2007-01-07 12:29:12 PST
Created
attachment 12283
[details]
sample code fixed typo
Geoffrey Garen
Comment 12
2007-01-07 12:30:35 PST
Created
attachment 12284
[details]
js library Changed search to AppleWebKit/, changed version to return an array of "." separated numbers.
Geoffrey Garen
Comment 13
2007-01-07 12:32:00 PST
Also changed versionIsAtLeast to take a string parameter.
Darin Adler
Comment 14
2007-01-07 21:10:21 PST
Comment on
attachment 12284
[details]
js library r=me -- a few small thoughts about refinement
> return RegExp("AppleWebKit/").test(navigator.userAgent); > var webKitFields = RegExp("(.*AppleWebKit/)([^ ]*)").exec(navigator.userAgent);
I think you should require a space before AppleWebKit in both of these regular expressions. Also, I suggest using a + rather than a * in the version number part of the expression.
> return undefined;
Generally I'd suggest returning null instead of undefined. I think undefined should be reserved for the meaning "this isn't defined at all".
> WebKit.versionIsAtLeast = function versionIsAtLeast(minimumString)
Why do the functions themselves have names as well as the name of the property of the WebKit object? Is this helpful?
> // Defaults to "" > minimumString = String(minimumString);
I don't understand the value of this line of code. Are we trying to make this function work if people call with things that aren't strings? Are you sure that WebKit is the best name for this object? I think it works well for the WebKit.versionXXX functions, but not as well for the WebKit.isWebKit.
Geoffrey Garen
Comment 15
2007-01-08 13:27:29 PST
> > return RegExp("AppleWebKit/").test(navigator.userAgent); > > var webKitFields = RegExp("(.*AppleWebKit/)([^ ]*)").exec(navigator.userAgent); > > I think you should require a space before AppleWebKit in both of these regular > expressions. Also, I suggest using a + rather than a * in the version number > part of the expression.
Done.
> > return undefined; > > Generally I'd suggest returning null instead of undefined. I think undefined > should be reserved for the meaning "this isn't defined at all".
Done.
> > WebKit.versionIsAtLeast = function versionIsAtLeast(minimumString) > > Why do the functions themselves have names as well as the name of the property > of the WebKit object? Is this helpful?
It's a preferred style in JavaScript because named functions help with debugging. Imagine: var f = WebKit.versionIsAtLeast; ... log("About to call function: " + f);
> > // Defaults to "" > > minimumString = String(minimumString); > > I don't understand the value of this line of code. Are we trying to make this > function work if people call with things that aren't strings?
I was, but now I think that was a bad idea.
> Are you sure that WebKit is the best name for this object?
Changed to WebKitDetect. Really, it's intended to be a namespace, not an object.
Geoffrey Garen
Comment 16
2007-01-08 15:13:13 PST
Marking "fixed" to clear from the review queue. I still need to get privileges before I can upload this to trac.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug