Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> What Is Opera's App Name?
Jeune
post Nov 13 2005, 12:21 PM
Post #1


Member [Level 2]
*****

Group: Members
Posts: 87
Joined: 20-October 05
From: Philippines
Member No.: 13,144



My dad has a Nokia communicator, that phone which looks like a small laptop, and so I tried to look at my My Webpagewith it.

The communicator uses the Opera browser and as it turned out, my javascript, a counter that counts how many days before my birthday and christmas didn't display the number of days correctly.

So while I am trying to discover how it will wok in Opera, I would barr people using Opera browsers from my site. Problem is I don't know Opera's appname.

Can anybody tell my what it is?

My code will looke like this

CODE

if (navigator.appName="Whatever Opera's app name is") {
    my code etc etc;
}


I know internet explorer's appName is Microsoft Internet Explorer and
Firefox's is Netscape.

Is Opera's appName Opera?
Go to the top of the page
 
+Quote Post
slu
post Nov 20 2005, 08:38 PM
Post #2


Newbie [Level 2]
**

Group: Members
Posts: 27
Joined: 22-June 05
Member No.: 8,557



QUOTE(Jeune @ Nov 13 2005, 02:21 PM)
My code will looke like this

CODE

if (navigator.appName="Whatever Opera's app name is") {
    my code etc etc;
}


I know internet explorer's appName is Microsoft Internet Explorer and
Firefox's is Netscape.

Is Opera's appName Opera?
*



No, Opera's appName is Netscape! It might seem weird, but it has been chosen for compatibility reasons....

You need to check the User Agent String to detect whether a Opera browser is used. The User Agent String will include the name "Opera", so your code could be written like this:

CODE

if ((navigator.userAgent).indexOf("Opera") != -1) {
    your code etc etc;
}


If you really want to go in to the gory details of browser detection check out the Browser Capabilities Project.
Go to the top of the page
 
+Quote Post
Tyssen
post Nov 21 2005, 02:52 AM
Post #3



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



You're gonna bar Opera users from your site just cos a javascript counter doesn't work properly? huh.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics


 



- Lo-Fi Version Time is now: 8th October 2008 - 09:46 AM