Mission: To redirect based on the URL in a generic sligshot way $(document).ready(function(){ var str = location.href; marketoURL = str.search(/marketo.com/); //We don't want this to fire if its in edit mode. //Example URL pagename.html?url=http://something.com/whatever.htm var redirectURL = $(document).getUrlParam("url"); if (marketoURL > 0 || redirectURL == undefined || redirectURL == null) { //do nothing, we are in edit mode } else { redirectURL = decodeURIComponent(redirectURL); location.href = redirectURL; } }); No HTML