Mac / Safari observations
ryandesign
Status: New User - Welcome
Joined: 20 Oct 2004
Posts: 2
Location: Bonn, Germany
Reply Quote
Hi. I was directed to this page...

techpatterns.com/downloads/php_browser_detection.php#omniconfig

...from this page:

de.php.net/manual/en/function.get-browser.php

On the Tech Patterns page, my current info is displayed like this:

Operating System:
MacIntosh OS X

Current Browser / UA:
User Agent: Safari
Full Version Info: 125.9
XHTML support: No

System Language
Primary Language id: en
Primary Language:
English

Current Screen Resolution
1280 x 753 pixels

Javascript
Javascript is enabled.

Cookies
Cookies are enabled

There are a couple problems with this.

1) My screen resolution is actually 1280x854. It is possible that the visible area (once you subtract menubar and Dock) is 1280x753, but it should not then be advertised as the "screen resolution". You could advertise it as the /available/ screen resolution.

2) JavaScript is properly spelled with a capital "S".

3) To the best of my knowledge, Safari does support XHTML. At least, it never complains about any XHTML web pages I write.

4) Macintosh is spelled with a lowercase "i", but anyway, the operating system is correctly called Mac OS X, not Macintosh OS X.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Thanks for the questions. The points you mention are either output text configurations, or Safari issues, which we can't do anything about.

:: Quote ::
1) My screen resolution is actually 1280x854. It is possible that the visible area (once you subtract menubar and Dock) is 1280x753, but it should not then be advertised as the "screen resolution". You could advertise it as the /available/ screen resolution.


You'll have to raise that issue with the KHTML/Safari team, what is being returned is what Javascript is being told by the browser.
Relevant JS:
width = (screen.availWidth)?screen.availWidth:'';
height = (screen.availHeight)?screen.availHeight:'';

screen.availWidth/Height is a pretty standard Javascript thing, so if Safari is reporting an incorrect width [we've seen this before, it seems to be related to something else, some windows boxes also report a slightly incorrect width or height]. However, we have no control over the output of a Javascript method.

:: Quote ::
2) JavaScript is properly spelled with a capital "S".

Change the string value in the 'Your Computer' script to whatever you want it to be. We changed this now, thanks, how the output looks isn't something we think a lot about to be honest.

:: Quote ::
3) To the best of my knowledge, Safari does support XHTML. At least, it never complains about any XHTML web pages I write.

We were wondering about this, however now you know, Safari doesn't support XHTML. That test is based on this PHP method:
$full .= ( stristr( $_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) ? 'Yes' : 'No';

If the browser accepts application/xhtml+xml it will return true, if it doesn't it will return false. The 'No' you are seeing is the browser telling the script it doesn't accept this mimetype, so unless it's not telling the truth Safari does not in fact accept this mimetype.

As far as we know, only Mozilla/Gecko and Opera >=7 support mime type application/xhtml+xml

Unless you are serving XHTML pages as this mimetype, which 99% of XHTML pages don't, you are not actually using XHTML, you are using HTML, mime type text/html, which basically means you are relying on browsers interpreting incorrect HTML, tag soup, and not breaking.

To learn more about this question, read this thread on XHTML. To learn how to deliver real XHTML pages, read this thread on how to set mimetype headers for XHTML

Our main site, techpatterns.com is done in XHTML 1.0 strict, but this mime type is only served to validation engines due to technical issues with XHTML not supporting javascript document.write. You can see this in action by clicking on the lower left W3C XHTML link, that will validate the page, as you can see from the results, the W3C is being given mimetype application/xhtml+xml. Now go to your favorite 'XHTML' sites, and validate them. In almost all cases you will see that the mime type being served is not xhtml+xml, but plain old text/html. XHTML is one of the biggest myths on the internet currently.

To see a real XTML 1.1 site, go to phoenixwebtech.com. If your browser supports XHTML, real application/xhtml+xml you will be served that mimetype, if it doesn't, you get text/html.
:: Quote ::
4) Macintosh is spelled with a lowercase "i", but anyway, the operating system is correctly called Mac OS X, not Macintosh OS X.

Change the output to satisfy your tastes, we have now updated this. This is merely an output though, nothing to do with the actual functioning of the script.
Back to top
ryandesign
Status: New User - Welcome
Joined: 20 Oct 2004
Posts: 2
Location: Bonn, Germany
Reply Quote
:: techAdmin wrote ::
You'll have to raise that issue with the KHTML/Safari team, what is being returned is what Javascript is being told by the browser.
Relevant JS:
width = (screen.availWidth)?screen.availWidth:'';
height = (screen.availHeight)?screen.availHeight:'';

screen.availWidth/Height is a pretty standard Javascript thing, so if Safari is reporting an incorrect width [we've seen this before, it seems to be related to something else, some windows boxes also report a slightly incorrect width or height]. However, we have no control over the output of a Javascript method.


No no -- screen.availWidth and .availHeight are the width and height, in pixels, of the area that's available for the browser to occupy, after space for fixed operating system widgets (menubar and Dock on Mac, task bar on Windows, etc.) has been subtracted. See here:

www.mozilla.org/docs/dom/domref/dom_window_ref94.html

Screen.width and .height represents the entire screen space. It's just a matter of what you're calling it on your page.

Some browsers return the width/height of the main monitor, some return the width/height of the combined space of all attached displays. But that's another problem entirely.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Thanks for that clarification. That's right, however this is merely a matter of preference, whichever method you prefer can be used in the 'Your Computer' script. However, you are right in this case, we'll change that.

The reason that wasn't caught before is that we all use hidden taskbars, so the screen.availabeWidth/Height always reported as the correct resolution.

For most purposes I tend to use 'screen.availableWidth' because that's more useful in terms of presentation, but in this case you're right, since the numbers should actually be the screen resolution. You're the first person to ever catch that, thanks..

That's now updated on the site scripts and on the 'Your Computer Info' download, as of version 1.0.4.
Back to top
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
By the way, in case this was unclear, non of the points ryandesign raised are connected to the actual php browser detection script, those are all simply output things, used by the 'Your Computer Information' script.

The main browser detection script does not do any formatting, nor does it contain any javascript, or mime type information, although we may add mime type detection at some point in the future, or simply create a stand alone mime type detection module, sort of like the PHP language detection script. The main script is already pretty big, I don't think it needs to grow much more, in fact we're looking at trying to optimize the main code on the 5.0.0 release, time permitting.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours