SMF For Free Support Forum
Signup For Free Forum
September 02, 2010, 11:55:07 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1] 2
  Print  
Author Topic: [Code] Browser Detect  (Read 2204 times)
0 Members and 1 Guest are viewing this topic.
Agent Moose
Moderator
*****
Offline Offline

Posts: 825


Do not PM me for Code Support or Request


View Profile
« on: September 23, 2007, 06:55:15 pm »

Add this to your Headers if you don't have it already.  If you already have it, don't add it:
Code:
<script src="jquery.js"></script>

Headers or Footers:
Code:
<script>
function browser_detect(){
$(function(){
//Created by Agent Moose
if ($.browser.mozilla) {$("#b_d").append("<b>Mozilla FireFox</b>")}
if ($.browser.msie) {$("#b_d").append("<b>Internet Explorer</b>")}
if ($.browser.safari) {$("#b_d").append("<b>Safari</b>")}
if ($.browser.opera) {$("#b_d").append("<b>Opera</b>")}
$("#bodyarea").before("You're using <span id='b_d'></span>")
});};
browser_detect();
</script>

This will just detect what browser a your using.  SImple, yet awsome.
« Last Edit: December 17, 2007, 07:29:55 pm by Agent Moose » Logged

Check out Revolution X's Brand new Code Index!
Coreeeey
SMF For Free Sr. Member
*
Offline Offline

Posts: 305



View Profile WWW
« Reply #1 on: September 23, 2007, 07:24:00 pm »

What's the point of it?
Logged

Agent Moose
Moderator
*****
Offline Offline

Posts: 825


Do not PM me for Code Support or Request


View Profile
« Reply #2 on: September 24, 2007, 02:26:22 pm »

IT will show what browser your using.
Logged

Check out Revolution X's Brand new Code Index!
Coreeeey
SMF For Free Sr. Member
*
Offline Offline

Posts: 305



View Profile WWW
« Reply #3 on: September 25, 2007, 08:10:22 am »

Hey Moosie Goosie, in your code you used the wrong form of the word "your" where it says "Your using" in your code, it should say "You're using" That would be the grammatically correct way to spell it for that usage.

And I'm not sure but, in this part of your code:
Code:
if ($.browser.opera) {$("#b_d").append("<b>Operta</b>")}
It doesn't match, one says opera but the other says Operta.

BTW, how is the opera browser because I've never used it.
« Last Edit: September 25, 2007, 11:36:40 am by Coreeeey » Logged

Agent Moose
Moderator
*****
Offline Offline

Posts: 825


Do not PM me for Code Support or Request


View Profile
« Reply #4 on: September 25, 2007, 02:22:29 pm »

Fixed.

I have never used a opera browser.  So I wouldn't know.
Logged

Check out Revolution X's Brand new Code Index!
Kimmie
SMF For Free Master
*
Offline Offline

Posts: 2010


View Profile WWW
« Reply #5 on: September 25, 2007, 04:42:16 pm »

Hey Moosie Goosie, in your code you used the wrong form of the word "your" where it says "Your using" in your code, it should say "You're using" That would be the grammatically correct way to spell it for that usage.

And I'm not sure but, in this part of your code:
Code:
if ($.browser.opera) {$("#b_d").append("<b>Operta</b>")}
It doesn't match, one says opera but the other says Operta.

BTW, how is the opera browser because I've never used it.

Opera is AWESOME!!!!!!!! It puts FF to shame (and it uses less resources to run).  Cool
Logged

Knightcastle
SMF For Free Member
*
Offline Offline

Posts: 75



View Profile WWW
« Reply #6 on: November 21, 2007, 08:29:18 am »

Neat Code Agent Moose!
Logged

mr_css
SMF For Free Sr. Member
*
Offline Offline

Posts: 252



View Profile
« Reply #7 on: November 21, 2007, 09:24:05 am »

you can get opera from download.com
Logged


            WOLFSCAPE FORUMS
Agent Moose
Moderator
*****
Offline Offline

Posts: 825


Do not PM me for Code Support or Request


View Profile
« Reply #8 on: November 21, 2007, 09:48:17 pm »

Neat Code Agent Moose!
Glad ya like it Smiley
Logged

Check out Revolution X's Brand new Code Index!
trevix
SMF For Free Sr. Member
*
Offline Offline

Posts: 302



View Profile WWW
« Reply #9 on: November 21, 2007, 10:15:42 pm »

you can get opera from download.com

or from opera.com >.>
Logged


Ad Machine - Free advertising and tips on how to promote your board.
Andrew
Helpers
*
Offline Offline

Posts: 1792


Andrew at your service


View Profile WWW
« Reply #10 on: December 22, 2008, 06:21:17 pm »

Does it just detect it for YOU, or does it detect for all members?

I put this in my headers. All I get from it is, below the ads You're using:, and thats it. Is it the style I'm using or something? Just not sure  Undecided
« Last Edit: December 22, 2008, 06:27:34 pm by Andrew » Logged

Colette Brunel
SMF For Free Sr. Member
*
Offline Offline

Posts: 423



View Profile
« Reply #11 on: December 22, 2008, 06:55:45 pm »

Does it just detect it for YOU, or does it detect for all members?

I put this in my headers. All I get from it is, below the ads You're using:, and thats it. Is it the style I'm using or something? Just not sure  Undecided

What browser are you running?
Logged
Andrew
Helpers
*
Offline Offline

Posts: 1792


Andrew at your service


View Profile WWW
« Reply #12 on: December 22, 2008, 11:33:49 pm »

Internet Explorer
Logged

Colette Brunel
SMF For Free Sr. Member
*
Offline Offline

Posts: 423



View Profile
« Reply #13 on: December 23, 2008, 09:37:43 am »

The code that Moose provided is kinda hacky and reliant on what you add to the if() clause. I've prepared a script that will parse out the name of your browser without having to define what it is...

Use this as a replacement for Moose's code:

Code:
<script type="text/javascript">
var browser_name=navigator.appName;
document.write("Browser name: "+ browser_name);
</script>
Logged
Andrew
Helpers
*
Offline Offline

Posts: 1792


Andrew at your service


View Profile WWW
« Reply #14 on: December 23, 2008, 11:16:47 pm »

Awesome! It worked this time, thanks!
Logged



Pages: [1] 2
  Print  
 
Jump to:  



Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Hostgator Hosting
Page created in 0.422 seconds with 20 queries. (Pretty URLs adds 0.043s, 2q)