Forum Moderators: open

Message Too Old, No Replies

Testing pages for Safari compatibility

         

lobo235

4:23 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



All of the computers I own and use are PCs. I would like to be able to test my web pages with the Safari browser that most Mac users seem to be using. Is there any way to insure that my pages will work on Safari using a PC? I thought that Safari was very similar to Firefox in the way that it rendered pages but I recently found out from one of my friends that uses a Mac that the design on one of my pages was hosed when viewed with Safari.

Tomness

5:09 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



I also have this problem. I recently had a complaint about a website I run for a band, and it looked all out of proportion.

I was sent a screen shot, and it looked pretty bad.

Is there anyway I can get a Safari mirror program for a PC?

Or are there any non-mac browsers that render pages like Safari.

encyclo

5:14 pm on Jul 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Safari has a close cousin in KDE's Konqueror browser, which is available as part of the KDE desktop environment in many Linux distributions. You can test for compatibility with Konqueror without installing Linux by using a Live-CD such as Kubuntu [kubuntu.org] or Knoppix.

However whilst Safari uses the same KHTML rendering engine as Konqueror, differences remain: so to be certain, you will still need to test in Safari, which is not available for anything other than a Mac. There are a few services available which offer screenshots of your site in different browsers, but this won't verify functionality - it is just a visual check.

webeditor coutre

3:09 pm on Jul 28, 2005 (gmt 0)

10+ Year Member



I was about to post this same issue and found it already here. I had the same experience--my newly launched website displays great in IE, Firefox, and Netscape, but it is hosed in Safari on Mac.

My question was, Is there a way to specify a separate stylesheet for only one browser (SAFARI on Mac), while letting all other browsers (IE, Firefox, Netscape, etc.) use the current/default stylesheet?

lobo235

4:04 pm on Jul 28, 2005 (gmt 0)

10+ Year Member



I have done this using PHP on a number of occasions. You just need to see what their user agent is and choose the css file to use based on that information. The user agent can be tampered with however so it's not a foolproof method.

webeditor coutre

4:29 pm on Jul 28, 2005 (gmt 0)

10+ Year Member



Thanks for the info. So I guess there's no easy way to say in the header of a page, "for safari-browser, go to safari-stylesheet.css" or anything like that...? I know it's too much to ask. :)

tedster

5:02 pm on Jul 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Should be doable with javascript in the head. Put this in the <head> but always AFTER the default css link so you can use the cascade overwrite whatever rules you need to from your default.css file.

<script type="text/javascript>
ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("safari")!=-1) {
document.write('<link rel="stylesheet" href="yoursafari.css" type="text/css">')
}
</script>

Also, you could use an "else" statement to write in the default.css for the rest of the browsers, but that would keep all browsers with js turned off from getting any stylesheet.

I wouldn't worry too much about user agent switching in this case:

1. The user knows if they've done it
2. Safari is already a small percentage of the browser universe, and those who switch user agent would be a small percentage of a small percantage

[edited by: tedster at 5:11 pm (utc) on July 28, 2005]

2by4

5:05 pm on Jul 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



To make matters worse, the new Applewebkit rendering engine has been more or less forked from the KHTML project, last I read KHTML isn't willing to implement the newer changes apple did because they don't fit the coding standards the khtml team was working with.

This means that the 100 series Safari browser can roughly be considered to equal the Konqueror that comes on the newer live kde linux cds, 3.3 or 3.4, but the 3 and 400 series of Safari will be significantly different. Safari has already passed the CSS acid test, although that was an experimental prototype version, KHTML isn't remotely close to that.

Because Safari is just one mac product that uses applewebkit, it's safer to detect for applewebkit than safari, and it's definitely safer to test using server side scripting than javascript.

encyclo

5:12 pm on Jul 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Safari has already passed the CSS acid test ... KHTML isn't remotely close to that.

Konqueror has also passed the Acid2 test, partly with the patches from Safari, and partly with rewritten code. It will be available in KDE 3.4.2, probably before the Acid2 Safari version is released.

2by4

6:16 pm on Jul 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Oh, that's good to hear, for a while there it sounded like KHTML was not going to integrate all the new applewebkit stuff, their developer's were really annoyed and were talking fork, but maybe common sense finally prevailed. Last thing the world needs is yet another browser version in terms of the rendering engine.

That means an uptodate linux livecd distro will do the trick, usually either kubuntu or kanotix are very recent versions, haven't checked out kde 3.4 yet though. One of those two will usually handle the hardware of your computer just fine, just grab both and see which works better.

If safari and konqueror are more or less remaining similar, detecting for 'khtml' is the safest way to go I think.

dcrombie

11:30 am on Jul 29, 2005 (gmt 0)



The Apple WebKit is now open source which is why the KHTML team have been able to 'catch up' ;)

[webkit.opendarwin.org...]