javascript - location.href return strange URL -
i'm using location.href
full url exists in browser address bar.
provide more detail, it's important note our service has js file included in our customers sites. js file generate full url of applicant.
i thought url somehow previous url redirected real domain, how should prevent action?
the line of js code generate link iframe's src attribute is:
'http://sd.domain.ir/index.php?r=' + math.floor(math.random() * (100000000 - 0 + 1)) + 0 + '&ref=' + ((window.btoa) ? btoa(location.href) : 'ie') + '&responsive=' + ((document.queryselector('meta[name="viewport"][content*="width=device-width"]')) ? 'yes' : 'no') + '¶ms='
examples of applicant ua:
mozilla\/5.0 (linux; u; android 4.3; en-us; huawei g620-l72 build\/huaweig620-l72) applewebkit\/534.24 (khtml, gecko) version\/4.0 mobile safari\/534.24 t5\/2.0 bdbrowser\/6.1.0.4
mozilla\/5.0 (linux; u; android 4.4.3; en-ae; htc_one build\/ktu84l) applewebkit\/534.30 (khtml, gecko) version\/4.0 mobile safari\/534.30
mozilla\/5.0 (linux; u; android 4.3; en-us; gt-i9300 build\/jss15j) applewebkit\/534.30 (khtml, gecko) version\/4.0 mobile safari\/534.30
...
sometimes strange url generated location.href
, don't know reason. example:
try this
var myurl = location.origin + decodeuricomponent(location.pathname);
basically same location.href should works
Comments
Post a Comment