Code Monkey home page Code Monkey logo

noreferrer's Introduction

noreferrer.js

Cross-browser support for HTML5's noreferrer link type.

HTML5 defines a new link type called "noreferrer" which may be used to annotate a hyperlink to indicate that a Referer (sic) header should not be sent when following the link.

This is particularly useful when you want to put hyperlinks to external resources on your private site which URL should not be leaked.

At the time of writing, WebKit-based browsers such as Safari, MobileSafari, Chrome and Opera 15+ already support this feature but IE, Firefox and Opera 12- do not.

This package contains two variants of JavaScript implementations that add the "noreferrer" link type to those browsers without native support.

Requirements

  • noreferrer.js depends on:

    • prototype.js 1.6 or later
  • jquery.noreferrer.js depends on:

    • jQuery 1.2 or later

Compatibility

  • Chrome, Safari, MobileSafari, Opera 15+ and other WebKit-based browsers

    These have native support for noreferrer links, so noreferrer.js does nothing.

  • IE 6+

    noreferrer.js uses a simple meta refresh technique to suppress Referer, plus disables opening a new window with middle clicking.

  • Opera 12-

    There seems to be no way to prevent the browser from sending a Referer header, so noreferrer.js replaces all noreferrer links with those using Google's redirector.

  • Firefox and other browsers

    noreferrer.js uses a data URI technique to suppress Referer, plus disables opening a new window with middle clicking.

Usage

Just include either noreferrer.js or jquery.noreferrer.js, depending on the JavaScript framework you are using, at the end of the part of an HTML document, and an onload event handler is attached to enable the noreferrer trick for each link with the noreferrer rel type.

<script type='text/javascript' src='noreferrer.js'></script>

It does not deal with dynamically created links at the moment.

History

  • v0.1.3

    • Bundled jquery.noreferrer.js.

    • Make small optimizations.

Author

Akinori MUSHA <[email protected]>

License

All files except for ones under "vendor" are licensed under a 2-clause BSD license.

See LICENSE for the copyright information and license terms.

noreferrer's People

Contributors

knu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

noreferrer's Issues

not work on IE11

in IE11 it genarated a data-uri link like this

data:text/html;charset=utf-8,%3Chtml%3E%3Chead%3E%3Cmeta%20http-equiv%3D'Refresh'%20content%3D'0%3B%20URL%3Dhttp%3A%2F%2Fwww.whatismyreferer.com%2F'%20%2F%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E

and then. IE don't support data-uri html, it says can't display this page

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.