jaimex8
12/9/2015 - 11:02 PM

Updating devsite links

Updating devsite links

<!-- Update Dev site links -->
// Make all links & forms to main site stay on the dev site
$(window).load(function() {
    $('a').each(function(){
        var $this = $(this),
        href = $this.attr('href');
        if(href !== undefined){
            href = href.replace('www.example.com','dev.example.com');
            href = href.replace('https://dev.example.com','http://dev.example.com');
            $this.attr('href', href);
        }
    });
    $('form').each(function(){
        var $this = $(this),
        action = $this.attr('action');
        if(action !== undefined){
            action = action.replace('www.example.com','dev.example.com');
            action = action.replace('https://dev.example.com','http://dev.example.com');
            $this.attr('action', action);
        }
    });
});