开发者

hide hyperlink text of anchor <a> tag in browser status bar but it should navigate

  1. I have a referral project.
    1. In that there is an agent between the affiliate(my site) and the target site.
    2. So all hyperlinks displayed in my site will be redirected to the agents site and then it is redirected to the target site.
    3. The hyperlink itself is the link to the agents site.
    4. So i am displaying all products. I have given links to them. When users hover a hyeprlink you can see the href text displayed in the status bar which will be the agents site.
    5. The requirement is the hyperlinks of an agent site should not be displayed in the status bar.

My solutions and assumptions

  1. So i can use span onclick = window.location = hrefOfAgentLink.

  2. I have seen in other sites that they redirect to another scripting page and then the redirection takes place. for example http://sitename.com/click/id=32.

  3. The id refers to the hyperlink in database. hope they fetch the link and they do a location header to redirect to the 开发者_JAVA百科agent page.

Why so? because the user should not see where the link goes.

I want to know whether there is(are) any other option(s) so that the hyperlink will not be visible in the status bar and in the address bar when it is redirecting.

Anyway when redirecting the agents url is not visible because it immediately redirects to the target site.

I would like to have the stackoverflow users suggestions. Thank you.


You used to be able to set the status bar message using javascript, but you can not do that reliably anymore. This is most probably because the browser wants to protect the user. Instead of trying to hide the URL, perhaps you should work on a "redirect-URL" that looks reliable and that makes it obvious to the user both that it is a redirect-URL and where it is going. For example this kind of URL would both make me aware of where I am going and that my access is going to be recorded:

tracker.my-ad-network.com/stacktrace.com/ad/568

Instead of something like this (that would not make me feel safe):

dashj2.gggfbad.com/index.php?aid=1232808432&ref=123432.

And as noted above, start accepting serious attempt to help you or people will simply stop :)

Piotr


You can use the new data attribute so your code would look something like this:

<a href="/link/user/will/end/up/on" data-redir="tracking/link">link text</a>

Then in your JS, if you're using jQuery for example:

$('a').click(function(e){
    e.preventDefault();
    var loc = $(this).data('redir');
    window.location = loc;
}

Not too hacky for what you're trying to accomplish.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜