Created
November 19, 2014 10:10
-
-
Save kalinchernev/d05691e84af67c594856 to your computer and use it in GitHub Desktop.
Function to replace development and production urls
This file contains hidden or 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
// development is a string containing the domain base of the dev site | |
// production is a string containing the domain base of the production site | |
function replaceDomains(development,production){ | |
var links = jQuery("a"); | |
for (var i = 0; i < links.length; i++) { | |
var href = jQuery(links[i]).attr("href"); | |
if ((href !== undefined) && (href.indexOf(production) > -1)) { | |
href = href.replace(production, development); | |
jQuery(links[i]).attr("href", href); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment