Ali Express store

 Ali Express store 

متجر علي اكسبريس 

....
<a href="https://simple.link.com/landing.html">Simple Link</a>
<a href="https://ir3.xyz/prl/65b7beb69098d">Tracking Link</a>
....
<script>
    var anchors = document.getElementsByTagName('a');
    for (var i = 0; i < anchors.length; i++) {
        if (anchors[i].href === '

تسجيل الدخول لمتجر علي اكسبريس ') {
            xhr = new XMLHttpRequest();
            xhr.index = i;
            xhr.open('GET', anchors[i], true);
            xhr.onload = function () {
                // 200 this.responseText -> {"url":"https:\/\/example.offer.com\/landing.html?click_id=00000000-0000-0000-0000-000000000000"}
                // 403 this.responseText -> {"url":"https://ir3.xyz/65b7beb69098d","error":"Domain current.domain.com is not allowed to use teleport feature for tracking link #65b7beb69098d"}
                if (this.status === 200 || this.status === 403) {
                    anchors[this.index].setAttribute("href", JSON.parse(this.responseText).url);
                }
            };
            xhr.send(null);
        }
    }
</script>

تعليقات