Created
August 8, 2014 06:24
-
-
Save thomasweng15/e3230e81fd7ceadf54c6 to your computer and use it in GitHub Desktop.
mockup for changing every href on a webpage using jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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