Friday, October 19th, 2007

Relative URLs as //

Category: HTML, Tip

I had never thought to use relative URLs that are just relative to the protocol scheme as Ned Batchelder explains in his post on Http-https transitions and relative URLs.

  1. <img src='//' />

Who knew.

Posted by Dion Almaer at 11:00 am

1.8 rating from 128 votes


Comments feed TrackBack URI

Whew knew? Only those who read documentation.

Comment by Rick — October 19, 2007

I use this a lot specifically for this purpose of easily making the same content show on both secure and non-secure sites with mixed domains in the URL. Many lame browsers, like old versions of WebTV weren’t written by developers who read the documentation (like Rick points out) don’t support it. Fortunately, if you can get ahold of the developers and point out the RFC, most are willing to fix it, as happened when I contacted a research search engine with a busted mining bot.

Comment by Axel — October 19, 2007

Hey, that’s actually pretty cool. thanks for enlightening me ^^

Comment by Andy — October 19, 2007

Who knew? I sure didn’t!!

This is a useful tip–thanks for poiting it out.

Comment by Richard Davies — October 19, 2007

Every XSS hacker knows it really wel :P

Comment by Martin — October 21, 2007

Well, his site doesn’t work, so how serious could he be?

Comment by Nick — October 22, 2007

Leave a comment

You must be logged in to post a comment.