SkyHorse.Org

HTTP and HTTPS tags without using JavaScript

Very neat trick I found out recently is that if you omit the protocol from an HTML src tag it will use the same protocol as the current URL, which is ideal if you need to have one universal HTML tag that works with both HTTP and HTTPS without having to use JavaScript tricks to detect the protocol.
This is great to use with ad server tracking pixels for example, or any other images:

Standard HTML code:
<img src="http://www.google.co.uk/intl/en_uk/images/logo.gif">

Relative protocol version:
<img src="//www.google.co.uk/intl/en_uk/images/logo.gif">

A few important details:

  • The browser will use the same protocol for the image call as the base URL where the tag is on, akin to a relative-path URL. This means e-mail clients and the sorts (like file explorers) will not be able to use this (as there is no base URL)
  • Tested on IE6 + 7, FF2 + 3 and Safari 2 + 3.
  • Syntax is part of the HTML spec since 1995, just not widely used (don’t know why)
  • Google Buzz
  • Delicious
  • Facebook
  • Twitter
  • LinkedIn
  • Share/Bookmark
Tags: online-advertising, Web Design

Related posts:

  • What is… Behavioural Targeting? Part I: Contextual, Re-targeting and Interest-based targeting
  • The state of Online Advertising 2.0 – part 1: Microhoo?
  • Behavioural Targeting: The Future (a video by Audience Science)

This entry was posted on Tuesday, November 11th, 2008 at 7:44 pm and is filed under Computing, online media. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

« Top tips for flying in comfort and style
How does your website look like under Dillo 0.8 on a FreeBSD? »

One Response to “HTTP and HTTPS tags without using JavaScript”

  1. Manuel Padilha Says:
    November 12th, 2008 at 4:20 pm

    Useful! Thanks.

Leave a Reply

CAPTCHA Image
CAPTCHA Audio
Refresh Image
  • Tags

    AI apple behavioural-targeting business Computing cPanel deep packet inspection design Downloads Games GNU/Linux google hacking hacking Hardware headphones hosting Ideas Instant Messaging iphone marketing mod-security online-advertising online media Personal Philosophy phorm poker Programming satire scripts Security sociology startups technology Travel ubuntu v-moda Visionarism web-2.0 web-marketing Web Design WHM wunderloop yahoo
  • Pages

    • About
    • Web Server Administration
      • Auto update modsecurity rules – modsec.sh
      • DirectAdmin to cPanel : a partial BASH solution
      • The Definite Guide of Obscure Tweaks to Install and Maintain cPanel / WHM (version 10)
        • Configuring E-mail (Exim) related areas
        • Fixing open DNS servers
        • Monitoring your server
        • Scripts and misc information
        • Security by Obscurity
        • Tweaking apache web server
  • Twitter Updates

    • Ads

    • RSS NMA

      • MySpace allows users to sync with Facebook 31 August, 2010
      • YouTube in first full-length movie deal with Blinkbox 27 August, 2010
      • nma Social Media Social takes place next Thursday 26 August, 2010
    • RSS Brand Republic

      • STV appoints Peter Reilly as commercial director 1 September, 2010
      • Binatone beats Samsung and BlackBerry with budget tablet launch 1 September, 2010
      • Alterian expands social media offer with Intrepid acquisition 1 September, 2010
    • RSS iMedia Connection: Consumer Strategies

      • Social media: What lies ahead
      • The truth about consumers' targeting fears
      • 3 reasons your brand doesn't have more Facebook fans
    • RSS Behavioural Targeting news

      • Moving Targets: Somebody Follow Me, Please? - MediaPost Publications 1 September, 2010
      • Moving Beyond Behavioral Ads - ClickZ News 1 September, 2010
      • Cybercrime Still a Major Concern - eMarketer 1 September, 2010
      • DigiRant: Retargeting Needs Some 411 - digiday:DAILY 31 August, 2010
      • How to Make Google Matter in Social Media - GigaOm (blog) 30 August, 2010
    • RSS Adotas

      • Rose Abdicates Digg Throne as Revolt Continues 1 September, 2010
      • Irony Alert: Zuck Wants Privacy Too 1 September, 2010
      • Yahoo & Dex One Expand Partnership for the Locals 1 September, 2010
    • RSS MarketingVox

      • Top Industry News for 9-01-10: Target to sell Facebook Credits gift cards 1 September, 2010
    • RSS ExchangeWire.com

      • OpenX Partners CCI To Build Out Automated Ad Trading Platform In Japan 1 September, 2010
      • AdAudience Moving Its Audience-Buying Offering From Wunderloop to Nugg.ad 31 August, 2010
      • Aegis H1 Report Shows Sluggish Growth In Europe, But Global Revenues Up 3.1% 27 August, 2010
    • RSS Segmentacion por comportamiento

      • Nota de prensa sobre la compra de wunderloop por Audience Science. 5 July, 2010
      • El gigante americano Audience Science compra wunderloop 5 July, 2010
      • Orange lanza su propio AdExchange 31 March, 2010
    • RSS Sandlines

      • the iPad and Marketing 28 January, 2010
      • The anticipation of disappointment 7 December, 2009
      • Groundhog Day 27 November, 2009
    • Ads

    • Blogroll

      • 90kts
      • Acxiom Poker Nights
      • Amy’s blog
      • Bytter’s blog
      • morena flor no samba da saudade
      • Not Quite There Yet
      • Swedish Pirate Party
    • Cartoons

      • Geek & Poke
      • Order of the Stick
      • User Friendly
    • Gaming

      • Neverwinter Nights
    • online media

      • Knowledge for the Digital Economy
      • Mike on Ads
    • Personal

      • Atelier de Camisa
      • Banksy
      • Designarte
      • My Amazon Wishlist
      • SkyServers.Org
    • Science

      • New Scientist
      • Rex Research
      • ScienceBox
      • Wired
    • Security

      • GPG4Win
      • GPGol
      • GPGShell
      • Mod Security
      • Offline Windows NT(2k,XP) Password Recovery
    • Web Design

      • PageStrength
      • SiteScore
      • UrlTrends
    • Akismet

      55,513 spam comments blocked by
      Akismet
    • Meta

      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org

    © 2003 - 2010 Paulo Cunha | SkyHorse.Org is proudly powered by WordPress | Theme based on Bob