Have you ever wondered of creating a fake url/hyper link? A link which shows a particular destination on mouse-hover (URL in the status bar of the browser), but takes you to another page/url on clicking on it. Then you have came to the right place.... Here is the trick/code by which you can create a fake link by using javascript element, it is supported by almost all major web browsers and is very tiny:
If you want the link to open in same window/tab, then replace "window.open" (without quotes) with "location.replace" (without quotes) something like this:
The above code will create a link, which will show the destination url google.com on mouse-hover in the status bar, but will take you to youtube.com on clicking on it. It should look something link this: Fake Link. But the demerit of this is, it will work only if javascript is turned on/enabled in the visitor's web browser, otherwise the link will open the same url as it shows in the mouse-hover, as in this case it will open google.com if the javascript is disabled in the browser.... But thats not a very big deal, because all browsers have javascript enabled as default, and nowadays javascript is so important that, everyone keep it on always.... And one notable thing is anyone who is known to a little html can figure out the smartness we have done with the link, if IN CASE he/she happens to view the source of the page of the fake link, unless you have encrypted the source of your page.
Another thing to note in here is, when the user once clicked in this link, and visited an undesired location, he/she would not be able to go back in the previous page.
so go on, do some hacking.....
Regards
S.K
<a href="http://google.com" onclick="window.open('http://www.youtube.com'); return false;">Fake Link</a>
If you want the link to open in same window/tab, then replace "window.open" (without quotes) with "location.replace" (without quotes) something like this:
<a href="http://google.com" onclick="location.replace('http://www.youtube.com'); return false;">Fake Link</a>
The above code will create a link, which will show the destination url google.com on mouse-hover in the status bar, but will take you to youtube.com on clicking on it. It should look something link this: Fake Link. But the demerit of this is, it will work only if javascript is turned on/enabled in the visitor's web browser, otherwise the link will open the same url as it shows in the mouse-hover, as in this case it will open google.com if the javascript is disabled in the browser.... But thats not a very big deal, because all browsers have javascript enabled as default, and nowadays javascript is so important that, everyone keep it on always.... And one notable thing is anyone who is known to a little html can figure out the smartness we have done with the link, if IN CASE he/she happens to view the source of the page of the fake link, unless you have encrypted the source of your page.
Another thing to note in here is, when the user once clicked in this link, and visited an undesired location, he/she would not be able to go back in the previous page.
so go on, do some hacking.....
Regards
S.K
0 comments:
Post a Comment
Say something about this post..