Weblog entry #73 for Steve

Bandwidth saving for "identical" URLs
Posted by Steve on Tue 7 Feb 2006 at 15:27
Tags: none.

I had the following in one the CSS files this site uses:

  background: url("/images//sidebar-bg-right.png") 100% 0% repeat-y;

Strangely Mozilla couldn't tell that this image was the same as /images/sidebar-bg-right.png (a file which it has already loaded). This lead to each incoming new page request loading both the files:

  • /images/sidebar-bg-right.png
  • /images//sidebar-bg-right.png

Now I've removed the extra '/' character I'm saving about 4k of transfer per new-connection.

Nifty. But a little annoying that I hadn't noticed for so long.

 

Comments on this Entry

Posted by k2 (69.157.xx.xx) on Tue 7 Feb 2006 at 21:24
[ Send Message | View Weblogs ]

Probably a typo by me!

But I don't understand how two //s are handled by a browser. It must see the two //s differently than a single /, but ends up getting the same file in the end. Interesting. Is it what it supposed to do?

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 7 Feb 2006 at 21:25
[ Send Message | View Steve's Scratchpad | View Weblogs ]

I think the browser should be smart enough to realise the two URIs point to the same resource - so it should know that its cached copy is OK.

I can't think of any situation where there is a difference between "/", "//", or "//////". I'd check the spec but I'm too tired right now!

Steve

[ Parent | Reply to this comment ]

Posted by k2 (69.157.xx.xx) on Tue 7 Feb 2006 at 21:36
[ Send Message | View Weblogs ]

Steve, quotes got parsed the wrong way for the titles in the above two comments.

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 7 Feb 2006 at 21:39
[ Send Message | View Steve's Scratchpad | View Weblogs ]

So they did. I'll look into it, thanks.

Steve

[ Parent | Reply to this comment ]

Posted by k2 (69.157.xx.xx) on Tue 7 Feb 2006 at 22:08
[ Send Message | View Weblogs ]

Interesting to note that I removed the character entities from the title of #3 , and typed in the quotes manually. They were again fuzzed and parsed wrongly.

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search