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:

  • The state of Online Advertising 2.0 - part 1: Microhoo?
  • Deep Packet Inspection takes another blow
  • Server-side redirection (a.k.a. tunneling) with PHP

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 design DNS Downloads Games GNU/Linux google hacking hacking Hardware headphones hosting Ideas Instant Messaging iphone islam marketing online-advertising online media Personal Philosophy poker Programming satire scripts search 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

    • RSS Brand Republic

      • Muller hands £5 million Corners business to VCCP 5 January, 2009
      • Peugeot moves UK dealership business into Euro RSCG 5 January, 2009
      • Ogilvy launches new ad for Comfort Naturals range 5 January, 2009
    • RSS iMedia Connection: Consumer Strategies

      • Why basic reputation management isn't enough
      • 8 ways to increase targeting effectiveness
      • Branding without brands: 3 success stories
    • RSS Behavioural Targeting news

      • Behavioral targeting: what you need to know - ZDNet Asia 5 January, 2009
      • As Tracking Proliferates, Web Publishers Are Left Out - AdAge.com (subscription) 4 January, 2009
      • Online advertising's big thing - CanadianBusiness.com 2 January, 2009
      • 2008 Brought New Firms and New Concerns to Behavioral Targeting - ClickZ News 30 December, 2008
      • Mediaplex Releases Dynamic Behavioral Targeting Suite - MarketWatch 10 December, 2008
    • RSS Adotas

      • Fighting Fraud and Saving Money 5 January, 2009
      • Online Users Grow; Quality Content Doesn’t 5 January, 2009
      • Crispin Porter + Bogusky and TBWA Worldwide Win Awards 5 January, 2009
    • RSS MarketingVox

      • Twitter Finally Draws Attention from the Spammer Community
    • RSS SimsCity blog

      • Scalability 8 July, 2008
      • A message to Mac users 5 July, 2008
      • Transfering files from computer to iPhone 26 June, 2008
    • RSS Donald Hamilton

      • Online ad spending bucks trends 29 September, 2008
      • Ad:Tech 25 September, 2008
      • Phorm in the clear? 18 September, 2008
    • RSS Don't be Square

      • x 11 September, 2008
      • See no evil with TELEVISION 18 August, 2008
      • Science meets Culture = PHILOTAXIS 14 August, 2008
    • Ads

    • RSS mindcode

      • O Ensino… 1 December, 2008
      • Quote of the Day 30 November, 2008
      • Lemmings Tunes 25 November, 2008
    • RSS ZDnet Security

      • A technical look at how parallel processing brings vast new capabilities to large-scale BI and data analysis 5 January, 2009
      • What I learned in 2008 30 December, 2008
      • Perl PR: There's more than one way to do it 29 December, 2008
    • TechDispenser


    • 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

      • Hermetic Research
      • 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

      34,083 spam comments
      blocked by
      Akismet

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