Skip to content

Instantly share code, notes, and snippets.

@thomasweng15
Created August 8, 2014 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasweng15/e3230e81fd7ceadf54c6 to your computer and use it in GitHub Desktop.
Save thomasweng15/e3230e81fd7ceadf54c6 to your computer and use it in GitHub Desktop.
mockup for changing every href on a webpage using jQuery
$(document).ready(function () {
$('a[href]').each(function () {
var src = $(this).attr('href');
// check that the origin is the same
// if (window.location.origin != origin)
//query parameter handling needs to be more safe than this
src += "?knowledgepreview=true";
// assign href the new src link
$(this).attr('href', src);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment