Any Chromium Specific Property? I want to detect chromium browser by JavaScript

2,703 views
Skip to first unread message

Synaptik

unread,
Sep 28, 2011, 10:32:17 AM9/28/11
to Chromium-discuss
Recently I posted thread in w3schools forum that how do detect
chromium based browsers through JavaScript and they gave me this
template:

if(window.chromiumSpecificProperty) {


// Run chromium
} else {
alert("Your browser does not support this app");
}

So I'm in search of such property, please help me finding one.

Adam Prescott

unread,
Sep 28, 2011, 10:34:38 AM9/28/11
to santosh...@gmail.com, Chromium-discuss
On Wed, Sep 28, 2011 at 3:32 PM, Synaptik <santosh...@gmail.com> wrote:
 alert("Your browser does not support this app");

Is there a reason you aren't using feature detection over UA sniffing?

PhistucK

unread,
Sep 28, 2011, 10:50:31 AM9/28/11
to ad...@aprescott.com, santosh...@gmail.com, Chromium-discuss
Also, is there a reason you are not simply sniffing the userAgent string instead of hanging on to proprietary property that may disappear even from Chrome\Chromium?

Feature detection is much better, anyway. Next, proper navigator.userAgent matching. Next, (there might be others before that, but I got nothing right now) proprietary properties.

In the old days, developers used to check for document.all in order to know whether this is Internet Explorer, this made other browsers support it without showing it (typeof document.all === "undefined", but typeof document.all !== void 0).

In short, do not do this.

PhistucK



--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

Synaptik

unread,
Sep 28, 2011, 10:52:53 AM9/28/11
to Chromium-discuss
Does all chromium based browsers have same User Agent?
Don't mind, I'm not a hard core programmer,
I just wanna develop app for chromium

PhistucK

unread,
Sep 28, 2011, 10:58:16 AM9/28/11
to santosh...@gmail.com, Chromium-discuss
As far as I know, yes.

PhistucK



Synaptik

unread,
Sep 28, 2011, 11:05:55 AM9/28/11
to Chromium-discuss
Won't version number effect in detecting the chromium browsers?

PhistucK

unread,
Sep 28, 2011, 11:28:26 AM9/28/11
to santosh...@gmail.com, Chromium-discuss
Your question is not clear.

This (not recommended!!!) method should be sufficient, I guess -
var isChrome = navigator.userAgent.match(/Chrome\/\d+/) !== null;

PhistucK



On Wed, Sep 28, 2011 at 18:05, Synaptik <santosh...@gmail.com> wrote:
Won't version number effect in detecting the chromium browsers?

--

Caleb Eggensperger

unread,
Sep 28, 2011, 3:12:57 PM9/28/11
to santosh...@gmail.com, Chromium-discuss
If it's a Chrome web store app:

if (window.chrome && chrome.app && chrome.app.isInstalled) {
// Chrome app is installed.
} else {
// Direct to store to install the app.
}

Synaptik

unread,
Sep 28, 2011, 9:03:46 PM9/28/11
to Chromium-discuss
I am asking that user agent strings changed with each subversion, if I
used a particular string in my JavaScript then in next version of
browser JavaScript will become useless.

Synaptik

unread,
Sep 29, 2011, 1:53:54 AM9/29/11
to Chromium-discuss
@PhistucK
You are wrong, I have both Google Chrome and SRWare Iron.
I visited http://www.o4e.com/public/phpinfo.php and looked at the user
agent section.

Googe Chrome shows : Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1
(KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1
SRWare Iron shows : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/534.16 (KHTML, like Gecko) Iron/10.0.650.0 Chrome/
10.0.650.0

Even if I don't think about version, the sring of SRWare Iron has iron
in it.

PhistucK

unread,
Sep 29, 2011, 3:27:54 AM9/29/11
to santosh...@gmail.com, Chromium-discuss
Thank you for correcting me.

However, the user agent string test I suggested covers any user agent that has Chrome/X in it, so it would work.

Only the version changes when the... version changes. "Chrome/" always stays (until further notice, which is why you should not use that test).

PhistucK




--

Finnur Thorarinsson

unread,
Sep 29, 2011, 9:24:37 AM9/29/11
to phis...@gmail.com, santosh...@gmail.com, Chromium-discuss
Again, as Adam pointed out... 

> Is there a reason you aren't using feature detection over UA sniffing?   ... ?

Pam Greene

unread,
Sep 30, 2011, 4:28:25 AM9/30/11
to fin...@chromium.org, phis...@gmail.com, santosh...@gmail.com, Chromium-discuss
Look at the original question. He's trying to use feature detection, of a sort.

if(window.chromiumSpecificProperty) {

Synaptik, what people are trying to suggest is, don't check for Chromium. Instead, check for whatever it is in Chromium that you're actually trying to use. That way if some other browser also supports what you need, your app will work there too, with no changes.

If you tell us why you need to be running in Chromium, maybe we can give more specific help.

- Pam

omar solis

unread,
Sep 30, 2011, 3:24:35 PM9/30/11
to Chromium-discuss


On 28 sep, 16:32, Synaptik <santoshsynap...@gmail.com> wrote:
> Recientemente he publicado hilo en el foro w3schools que ¿cómo detectarlos navegadores basados ​​en cromo a través de JavaScript y me dieron estaplantilla:
>
> if (window.chromiumSpecificProperty) {
>
>   / / Ejecutar el cromoElse {}
>
>   alert ("Su navegador no soporta esta aplicación");
>
> }eso esta raro porque debe soportar chromiunelse
>
> Así que estoy en busca de esos bienes, por favor me ayude para encontrar uno.
Reply all
Reply to author
Forward
0 new messages