The negative side of having a new (and promisingly become popular) browser, no matter how good it can be, is you’ll have to test your web apps with it among many others.
Probably, the first step is to detect the browser from JavaScript code by parsing browser’s user agent, and here is what of Google Chrome.
I guess old JavaScript codes can mistakenly tell it Safari like when running the code snippet below using JQuery’s browser utility.
It may be no problem until you find something wrong when your apps running on Chrome only. So, here is the code line to detect Chrome generally:
We’ll have to change the JQuery browser utility to support Chrome detection as follows:
Now, correct result shows on test screen:
Just one notice: Current version of JQuery (1.2.6) is treating Chrome as if it was Safari and basically no serious problem has been found yet. Modifying browser detection can cause the lib render pages/elements incorrectly for it has no knowledge of Chrome’s rendering engine. To keep compatibility, you can change line 7 back to:
But in this case the browser will be detected as both Chrome and Safari — not nice solution, I accept.
Anyway, it’s very likely that JQuery and other JavaScript frameworks will include Chrome to browser list for detection in next versions.
No comments:
Post a Comment