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)
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

  • Tags

    AI apple behavioural-targeting business christianity 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
  • 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

      • Common currency an impossible dream, says Mindshare 12 March, 2010
      • Twitter lets users add their location to their tweets 12 March, 2010
      • Social media is a challenge for brands to measure 12 March, 2010
    • RSS Brand Republic

      • Guinness digital campaign aims to boost St Patrick's Day 12 March, 2010
      • Clear Channel Outdoor UK's revenue falls $30.4m in 2009 12 March, 2010
      • Lib Dems promise 'fairness' and 'change' in campaign slogan 12 March, 2010
    • RSS iMedia Connection: Consumer Strategies

      • The 4 Cs of scaling social media
      • The underlying drivers of social media success
      • How to turn user-generated content into profits
    • RSS Behavioural Targeting news

      • Why no one cares about privacy anymore - CNET 12 March, 2010
      • Why behavioural targeting is not the be all and end all - Econsultancy (blog) 12 March, 2010
      • When Behavioral Targeting Identifies A New Audience Segment - Mediapost.com 10 March, 2010
      • Go, and Target No More? - ClickZ News 10 March, 2010
      • 5 Digital Truisms for Marketers - Adweek 8 March, 2010
    • RSS Adotas

      • Got Funds? Todacell Scores a Cool Million 11 March, 2010
      • A Custom Postcard Thanks to Your Favorite Brand 11 March, 2010
      • Display, but Nothing Else, Hops on YouTube Mobile Site 11 March, 2010
    • RSS MarketingVox

      • An App for the Android? Your CFO Will Love You 11 March, 2010
      • CBS Uses 'Boss Button' to Promote Facebook Page 11 March, 2010
      • In Email v SocNet Debate, Harmony is One Answer 11 March, 2010
    • RSS ExchangeWire.com

      • How Online Advertising Really Works In Europe; Real-Time Bidding Best Practices Whitepaper 12 March, 2010
      • Paul Turner Talks Buy-Side Platforms, Automated Ad Trading And The Evolution Of European Display 11 March, 2010
      • Rubicon And AOL Deal Increases European Reach Of Yield Optimiser; Unanimis Using Alenty To Improve Ad Visibility And Engagement 10 March, 2010
    • RSS SimsCity blog

      • Attaching pixels to pages 2 January, 2009
      • Frequency capping 28 December, 2008
      • ITV player 27 December, 2008
    • RSS Donald Hamilton

      • Never a True Word said with an “F” 1 December, 2009
      • Whose audience is it anyway? 19 October, 2009
      • Online ad spending bucks trends 29 September, 2008
    • RSS Segmentacion por comportamiento

      • La “Santa Alianza” contra Google. 18 February, 2010
      • Torsten Ahlers, CEO de wunderloop, en el OMExpo2010 26 January, 2010
      • Lanzamiento de la Alianza de editores en Alemania, con la tecnología de wunderloop como motor. 26 January, 2010
    • RSS Sandlines

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

      • DMEXCO Premiere war erfolgreich / Topthema Targeting 6 October, 2009
      • Mit „Behavioral“ den optimalen Werbe-Weg finden 8 May, 2009
      • Mit ToDo und Toodledo das Chaos beherschen 6 May, 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

      51,326 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