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

Related posts:

  • ShiftForward – online advertising technology R&D
  • What The European Display Landscape Looks Like In 2010 | ExchangeWire.com
  • An interesting presentation on the display advertising landscape

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

      • Merkle Hires Ex-Accenture MD Robert Bushey as EMEA Chief Sales Officer 24 May, 2022
      • InfoSum & Adform Announce Global Partnership 24 May, 2022
      • IAS – Australian Viewers Prefer the CTV Ad Experience Over Linear TV 24 May, 2022
    • RSS Lies, Damned Lies…

      • Not dead yet: The long goodbye of third-party cookies 25 August, 2021
      • Nasty, brutish and short: The life of the modern CDO 26 May, 2021
      • GDPR, the sequel: Get ready for CCPA 20 April, 2020
    • 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 Unknown Feed

    • RSS Adotas

      • Steps to create a Computer Malware 22 May, 2022
      • Deciding on a Virtual Data Room 22 May, 2022
      • Expert Antivirus Services 18 May, 2022
    • RSS Brand Republic

    • RSS MarketingVox

    • RSS Behavioural Targeting news

      • Ministers urged to extend year for special schools - Irish Examiner 24 May, 2022
      • Web Analytics Market 2022 to Register Incredible Developments – Hootsuite Inc., Cognizant, At Internet, MicroStrategy Incorporated, Splunk Inc., etc – The Daily Vale - The Daily Vale 24 May, 2022
      • Dissemination and implementation strategies for physical activity guidelines among adults with disability, chronic conditions, and pregnancy: a systematic scoping review - BMC Public Health - BMC Public Health 23 May, 2022
      • BioMed Stocks On the Move: GeoVax Labs, Nova Mentis, SIGA and PharmaDrug; Life Sciences Leaders Report Latest Advances in Antiviral Vaccines, and Novel Therapeutics for Oncology, Glaucoma and Autism - GlobeNewswire 23 May, 2022
      • Here are the ICA 2022 talks featuring researchers from the Reuters Institute - Reuters Institute 23 May, 2022
    • 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
    • Meta

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

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