Skip to content Skip to sidebar Skip to footer

Redirect The Page If Anchor Text Is Not Match

Javascript Expert, i am a template developer and i used my link for credit link at the bottom in template. sometime people changed the anchor text of my site link, and i want if so

Solution 1:

Maybe something like...

$(function(){
    var $link = $('#copyright a');

    (function verifyCopyright () {
        if ($link.prop('href') !== 'http://www.thesofthelp.com' || $link.text() !== '**The Soft Zone**') {
            window.location.href = 'http://www.example.com';
        } else {
            setTimeout(verifyCopyright, 1000);
        }
    })();
});

So this would check every second to see if the text of the link changed and if so redirect. The reason I did it this way is if the user put in a script to change it dynamically after a certain period of time, an immediate check would fail.

Here's a concern with this though. If the users are not changing the template dynamically and are instead changing your actual script, what's to stop them from removing this verification? It seems like any solution will be very weak.

There are also other concerns. They could remove the element entirely. They could hide it. They could change it to position absolutely off the screen at -1000px. So many ways they could jack with any kind of verification like this.


Post a Comment for "Redirect The Page If Anchor Text Is Not Match"