Skip to content

Instantly share code, notes, and snippets.

@ryan-ethode
Last active November 10, 2016 15:32
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 ryan-ethode/b4df664e837afe9542167161878df7b5 to your computer and use it in GitHub Desktop.
Save ryan-ethode/b4df664e837afe9542167161878df7b5 to your computer and use it in GitHub Desktop.
URL Replacer: Used on a multi-site host to direct relative URLs from one host to another host.
$("a").each(function() {
if($(this).parents('.info').length) {
var href = $(this).prop('href');
var href = href.replace("https://somewebsite.com/", "https://someotherwebsite.com/");
$(this).prop('href', href);
$(this).attr('target','_blank');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment