javascript - if previous page url with “-cn” ending then change content in current page -
i making site in both english , chinese language, need detect if previous page url "-cn" ending (so know chinese page) change content in current page(default in english). thank you.
code below, sorry i'm new js
$(document).ready(function() { var referrer = document.referrer; //*detect if previous url without "-cn"ending nothing if "-cn" below //*change content inside "new"<div class="block"></div> }); <div class="block">old</div>
try one: think want this.
$(document).ready(function() { var referrer = document.referrer; if(referrer.indexof("-cn")>-1) { // referrer url contain "-cn" } else { // not contain "-cn" } });
Comments
Post a Comment