2 of 3
2
Plugin: Browser Sniff
Posted: 21 July 2008 02:34 PM   [ Ignore ]   [ # 19 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  420
Joined  10-10-2004

Nice! I’m going to check this out in a little bit.

Profile
 
 
Posted: 21 July 2008 02:41 PM   [ Ignore ]   [ # 20 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  03-05-2008

Let me know how it works for you. The version returned is the Safari build version not the WebKit version as you can see. You might find this handy for defining the right number range Safari and WebKit Version Information

Profile
 
 
Posted: 21 July 2008 03:05 PM   [ Ignore ]   [ # 21 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  420
Joined  10-10-2004

Yes, that’s it, works great. And that page with browser version history is perfect, thanks!!

Profile
 
 
Posted: 23 July 2008 08:07 AM   [ Ignore ]   [ # 22 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi eexperience,

Thanks for introducing new features into Browser Sniff plugin.

I will give a try and update the file in the first post in this thread.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 31 July 2008 01:02 AM   [ Ignore ]   [ # 23 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

I have updated Browser Sniff plugin. You can download version 1.1.9 using the link in the first post in this thred.

The code of the new version incorporates additions of Timon (eexperience) which allow for {browser_name} and {browser_version} variables to be used both inside and outside conditionals.

Many thanks, Timon, for your help!

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 31 July 2008 01:12 AM   [ Ignore ]   [ # 24 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  03-05-2008

Hi Laisvunas,
I’m glad I could be of help with my limited experience in coding.

Cheers,
Timon

Profile
 
 
Posted: 31 July 2008 12:24 PM   [ Ignore ]   [ # 25 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

I’m lovin’ this plugin.  It hard to target newer Safari/Webkit browsers with CSS “hacks” and this hits the spot!  cheese

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 02 August 2008 01:40 AM   [ Ignore ]   [ # 26 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

I have released version 1.2 of Browser Sniff plugin.

In this version a serious bug - PHP error message saying that browser_version variable is undefined being displayed when outputted browser name is “other” - was fixed.

Most importantly this bug prevented using online validation services such as W3C validator. After analyzing user agent string of a validator plugin outputted browser name “other”, then because of the bug a PHP error message was being printed on the top of the web page, and this automatically resulted into markup of the web page being invalid.

Everyone who uses Browser Sniff plugin is recommended to upgrade.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 06 September 2008 08:14 AM   [ Ignore ]   [ # 27 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

I just noticed that since the release of FF3 when you do a specific sniff for saf (safari), it picks up FireFox 3 too.  Any work around?  I need to specifically target Safari. 

This may be the fact that Firefox is somewhat built on the webkit platform.

Thanks!

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 06 September 2008 08:19 AM   [ Ignore ]   [ # 28 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

The workaround in the mean time it to target the CSS3 selector :nth-child that no other browser supports, save Safari 3, which does.

/*Safari 3.x webkit-min hack can effect Opera 9.x too*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
    
    
/* :nth-child target only Konqueror 3.x (Safari 3.x) hat tip to  http://tanreisoftware.com/blog/?p=39#konq*/
    
html:not(:nth-child(1)) add selector here{
        padding
: blah, blah...
    
}
}

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 06 September 2008 10:37 AM   [ Ignore ]   [ # 29 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi grantmx,

I just noticed that since the release of FF3 when you do a specific sniff for saf (safari), it picks up FireFox 3 too.

To test it I tried this code with Firefox 3.0.1 on Vista:

{exp:browser_sniff}
{if browser_name
=="saf"}
Browser name
: {browser_name}<br>
Browser version: {browser_version}
{
/if}
{
/exp:browser_sniff}

and it worked as expected, that is there was no output.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 06 September 2008 12:25 PM   [ Ignore ]   [ # 30 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

Using the same exact code:

{exp:browser_sniff}
{if browser_name
=="saf"}
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=include/safari}" />
{/if}
{
/exp:browser_sniff}

It shows the stylesheet in the code in FF3 on XP.  Am I behind on the version?  Running v1.2.

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 06 September 2008 02:56 PM   [ Ignore ]   [ # 31 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  03-05-2008
grantmx - 06 September 2008 12:25 PM

It shows the stylesheet in the code in FF3 on XP.  Am I behind on the version?  Running v1.2.

Have you checked the output for both browsers with this code:

{exp:browser_sniff}
Browser name
: {browser_name}<br>
Browser version: {browser_version}
{
/exp:browser_sniff}

Profile
 
 
Posted: 06 September 2008 06:37 PM   [ Ignore ]   [ # 32 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1055
Joined  06-05-2007

No, but how would that relate to the issue?

 Signature 

grantmx | designs - design | development | photography | consulting | ee pro profile

Profile
 
 
Posted: 06 September 2008 09:56 PM   [ Ignore ]   [ # 33 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  326
Joined  03-18-2007

It would let you more easily see where the glitch is if you knew how the plugin was reporting both browsers.

Profile
 
 
Posted: 07 September 2008 11:03 PM   [ Ignore ]   [ # 34 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Hi,

Using the same exact code:

{exp:browser_sniff}
{if browser_name
=="saf"}
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=include/safari}" />
{/if}
{
/exp:browser_sniff}

It shows the stylesheet in the code in FF3 on XP.  Am I behind on the version?  Running v1.2.

Trying your code with Firefox 3 on Windows XP I was unable to replicate the effect you described. That is, the result was as expected - no output.

The issue is not somehow connected with version 1.2 because all versions of Browser Sniff plugin use exactly the same code for browser recognition.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 08 September 2008 01:42 AM   [ Ignore ]   [ # 35 ]  
Grad Student
Avatar
Rank
Total Posts:  68
Joined  03-05-2008

Is it possible that your template code is cached and that’s the reason why you get the same results for both browsers?

Profile
 
 
Posted: 08 September 2008 09:18 AM   [ Ignore ]   [ # 36 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  290
Joined  02-02-2007

Is it possible that your template code is cached and that’s the reason why you get the same results for both browsers?

That should not be the reason.

Browser Sniff plugin recognizes which browser is used by parsing $_SERVER[‘HTTP_USER_AGENT’] variable. Plugin outputs {browser_name} as “saf” in case $_SERVER[‘HTTP_USER_AGENT’] variable converted to lowercase contains substring “safari” and it outputs {browser_name} as “moz” in case $_SERVER[‘HTTP_USER_AGENT’] variable converted to lowercase contains substring “gecko”.

Here is what $_SERVER[‘HTTP_USER_AGENT’] variable outputs in case browser is Firefox 3 on Vista:

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

Here is what $_SERVER[‘HTTP_USER_AGENT’] variable outputs in case browser is Firefox 3 on XP:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

As you can see there is no substring “safari”. This is the reason why the code

{exp:browser_sniff}
{if browser_name
=="saf"}
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=include/safari}" />
{/if}
{
/exp:browser_sniff}

outputs nothing, as it should, both for Firefox 3 on Vista and on XP.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
   
2 of 3
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65087 Total Logged-in Users: 32
Total Topics: 82229 Total Anonymous Users: 17
Total Replies: 441929 Total Guests: 203
Total Posts: 524158    
Members ( View Memberlist )