Testing Javascript through URL keyword
Below code can be used to test javascript with a keyword and will not affect main store.
Note: errors in code might break other scripts running on the live page.
if(window.location.href.indexOf("?MyKeyword") > -1){
// Code will only work with above keyword in url address
}
Below code will redirect url unless it has '?MyKeyword' in url.
Nice if you have to use a test product you can redirect to the main product in the product description.
if(window.location.href.indexOf("?MyKeyword") > -1){
// Code
}
else{
window.location.replace("www.google.com");
}