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)
DeliciousFacebookTwitterLinkedInShare/Bookmark
Tags: online-advertising, Web Design

Related posts:

  • ShiftForward – online advertising technology R&D
  • What is… Behavioural Targeting? Part I: Contextual, Re-targeting and Interest-based targeting
  • What The European Display Landscape Looks Like In 2010 | ExchangeWire.com

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
Refresh Image
*

  • Tags

    advertising AI apple behavioural-targeting business Computing cPanel deep packet inspection Downloads DSP Games GNU/Linux google hacking hacking Hardware headphones hosting Ideas Instant Messaging iphone marketing 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 ExchangeWire.com

      • Looking Beyond The Gadget Porn, What Were The Key Takeaways From This Year’s CES For Ad Tech? 27 January, 2012
      • AppNexus CEO, Brian O’Kelley, And Brian Lesser, CEO, Xaxis, Confirmed To Speak At Ad Trader Conference, Hamburg, On April 19 27 January, 2012
      • The PostView: Are Facebook And Amazon About To Disrupt The Multi-Billion Euro/Dollar Traditional Display Model? 26 January, 2012
    • RSS Lies, Damned Lies…

      • Building the Perfect Display Ad Performance Dashboard, Part II – metrics 20 December, 2011
      • Should Wikipedia accept advertising? 21 November, 2011
      • Building the Perfect Display Ad Performance Dashboard, Part I – creating a measurement framework 9 November, 2011
    • RSS iMedia Connection: Consumer Strategies

      • A consumer-driven mindset in a big media package
      • Learn to leverage the social-search connection
      • Your social media disaster kit
    • RSS Segmentacion por comportamiento

      • Your Stats Have a New Home 26 January, 2012
      • Reblogging is Back! 22 January, 2012
      • New Theme: Newsy 20 January, 2012
    • RSS Sandlines

      • The Social Phone doesn’t come with an IVR menu 7 November, 2011
      • Are you ready for Big Data? 2 November, 2011
      • Sandlines @ Mediapro 29 October, 2011
    • RSS Adotas

      • Sponsormob Leads the Way Into RTB for Mobile 26 January, 2012
      • Compass Labs Relaunches Behavior-Based Social Ad Targeting Platform 26 January, 2012
      • The User Data Ecosystem, Visualized 26 January, 2012
    • RSS NMA

      • Security fears lead O2 to exceed tweet limit 27 January, 2012
      • Facebook urges clearer understanding of social commerce 26 January, 2012
      • McDonald’s admits Twitter campaign failure 25 January, 2012
    • RSS Brand Republic

      • Telegraph prepares for London 2012 adspend lift with Allen appointment 27 January, 2012
      • Ireland's Out of Home sector drops 5% to total €194.6m in 2011 27 January, 2012
      • Video - Subway's Akhtar: the economy is Subway's biggest challenge 27 January, 2012
    • RSS MarketingVox

      • Top News: Buying online reviews | Twitter's censorship | Apple No.1 smartphone 27 January, 2012
    • RSS Behavioural Targeting news

      • Email offering takes small steps for greater results - BizReport 27 January, 2012
      • Videology Partners with I-Behavior and Kantar Shopcom to Extend CPG Purchase ... - MarketWatch (press release) 26 January, 2012
      • Channel 4's 'Richard Wilson On Hold' - I don't believe it… - The Drum 26 January, 2012
      • Advertisers to police themselves when targeting online users - Toronto Star 25 January, 2012
      • Zumobi hires former Microsoft director Marla Schimke to lead marketing - TechFlash (blog) 25 January, 2012
    • Ads

    • Blogroll

      • 90kts
      • Acxiom Poker Nights
      • Amy’s blog
      • Bytter’s blog
      • Impare Arquitectura
      • Impare Design
      • 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

      • Banksy
      • Designarte
      • Made to measure shirts – Atelier de Camisa
      • 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

      99,713 spam comments blocked by
      Akismet
    • Meta

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

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