Skip to content

MTco/hotlink.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hotlink.js

hotlink.js makes it possible to hide referrer information for hotlinked images. It is an easy-to-use drop-in script that requires very few changes to your webpages.

Demo

You can try out the online demo to see hotlink.js in action.

Supported Browsers

  • Google Chrome 12+
  • Safari 5.1+

†Firefox 5+, Internet Explorer 9+, and Opera 11.50+ will fall back to a normal image without a hidden referrer.

Getting Started

  1. Download hotlink.js (unminified).
  2. Replace <img src="..."> with <img data-src="..."> for every image that you want to hotlink on your site.
  3. Include <script type="application/ecmascript" async="" src="hotlink.js"></script> right before </body>.

API

void hotlink(HTMLImageElement image)

If you are using dynamically inserted images, you'll want to use the API to hotlink them.

Example

var image = new Image(300, 100);
image.setAttribute("data-src", "http://example.com/image.png");
document.documentElement.appendChild(image);
hotlink(image);

Disclaimer

This library is only to be used for research purposes and I am not responsible for anything you make with this library.

Tracking image

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 66.6%
  • CSS 20.0%
  • PHP 13.4%