Archive for the 'Browser' Category

Safari Problems Downloading .DMG Files

Monday, August 3rd, 2009

A while back I started having problems with Safari 4 being able to download files. Normally when one clicks on a .dmg or .zip file, Safari downloads it.

Recently, it stopped working, either doing absolutely nothing or trying to load the file into the browser itself for display. It was as if the MIME type wasn’t properly being handled.

Here’s how I fixed it.

It appears that Speed Download’s broswer plugin is to blame. While it works amazingly well with Safari 3, it doesn’t seem to work quite right with Safari 4.0.3.

  1. Quit completely out of Safari.
  2. Go to /Library/Internet Plug-Ins directory and locate the file SpeedDownload Browser Plugin.plugin and move it out of that folder.
  3. Restart Safari.

ModRewrite Woes (Solved!)

Wednesday, June 24th, 2009

While working on a project, I stumbled into some of the weirdest Apache2 mod_rewrite problems that I’d ever seen.

The goal was to make a URL like http//www.nowhere.com/item/1234 turn into http://www.nowhere.com/item.php?id=1234. Trivial, and I’ve done it all the time.

RewriteEngine on
RewriteRule ^item/(.+)$ item.php?id=$1 [L]

This time it wasn’t working the way I expected. When I used the human-readable version, my page got delivered by I had no images, no css, no javascript. Yet, if I used the computer-friendly long form with parameters, it worked just fine.

A little examination with Safari’s activity window showed me that in the initial case the browsers were looking at all relative URLs as if they were prefixed with /item/. This make sense, because the URL redirect knows how to play rewrite games with the rules to get to my page, but the relative links on those pages, to css, graphics, and js, had no clue this was a fake base url.

Many thanks to richardk who pointed out multiple solutions back in 2005.

  • Don’t use /, and there isn’t a problem.
  • Use absolute paths, though you have to edit all the links on your page; if using PHP, consider a variable for the base path.
  • Use a RewriteRule to hack off the offensive directory that doesn’t exist.
  • Or, use the <BASE …> tag.

Well, that rendered the page prettier, but I realized my argument wasn’t being passed in. Yet, the re-write rule was correct.

So I tried http//www.nowhere.com/item, which should not have matched and should not have brought up a page. Yet it did.

A little experimentation showed that any page that had a known extension was getting delivered.

What this meant was that the moment the browser saw /item it found the item.php page and delivered it without ever going through Apache’s rewrite module, and hence no parameters.

Luckily, I’ve encountered this symptom before in a different context. The offender: MultiViews. This is the bugger that deals with multiple language support; you know, where you have a zillion internationalized instances based on filename extensions….

Turning that off instantly solved the problem of delivering a file without an extension:
# Options Indexes FollowSymLinks MultiViews
Options Indexes FollowSymLinks

That also meant that the mod-rewrite rules worked. And that meant the parameters were passed correctly. And that meant I was was happy, because the code was working.

Firefox Slow Page Load – Solved

Friday, March 28th, 2008

A co-worker showed me an interesting problem with Firefox today. He loaded a page from our application (running on localhost) and the page content loaded instantly, but the page load itself didn’t end until a time out 20 seconds later. Literally.

Everything we saw a measured from the browser or from the sending application showed that the content was sent in milliseconds, and the page load was just sitting there doing nothing. We were even using the latest Firefox beta.

Other browsers had no such problem.

Turns out, we figured out what was going on using the Tamper Data add-on.

Turns out there was a Connection: keep-alive in the header. When we changed it from keep-alive to close, the browser behaved as expected. That is, it loaded the page instantly.

A little web investigation showed that when you use the keep-alive attribute, you must also use Content-Length: header, which the sending application wasn’t doing.

A quick application tweak to send the content length, and everything ran super spiffy.

Now, if you don’t have access to the application that’s sending you web pages, you can twiddle with the about:config and change the network.http.keep-alive setting to false.

Apple’s Top Secret Feature?

Tuesday, June 12th, 2007

According to WebWare, Apple is releasing its browser, Safari, for the Windows platform.

The initial question from the community is: Why? (Though this may be the wrong question..!)

Clearly the region of the browser application space has been filled by Internet Explorer, Firefox, Opera, and a handful of others.

Wouldn’t releasing Safari simply make the Windows environment more compelling to stay? This got me thinking…

What if multi-platform Safari wasn’t the point at all, but it was actually a proof of concept of something greater?

A while back, Apple made the stunning announcement that it had been secretly working on a way to take the same source code and produce a PowerPC version and a Intel (Mac) version, and have them look identical. Combined together, they make the Universal Binary, which is a program that can be run on either system architecture. This was no small feat of clever engineering.

What if the Top Secret feature is that they’ve added Windows as a target for the same source code? Already RealBASIC is doing it, but that’s BASIC, not the mixed language richness of XCode.

As a developer, if I can use Apple’s amazing environment to produce Windows code, I’m all for it.

As a business owner, if I can produce applications and have them work on Apple’s customers as well, I’m all for the additional marketspace.

And, …if I’m a home user… if I’m wanting to switch to Mac, but I’m tied to the Windows platform because of application lock-in, this is a breath of freedom if my applications and data work elsewhere.

Could it be that Apple has taken Safari and simply “recompiled” it? That this is merely the test run to give applications independence of Windows, allowing users to switch over to a kinder, friendlier environment?

I’d like to think so.


Bad Behavior has blocked 282 access attempts in the last 7 days.