开发者

Javascript mailto causing IE issues

In my html page, I have:

var e_values = $("a.envelope");
e_values.each(function(index){
    $(e_values[index]).attr('href','mail'+'to:'+eval($(e_values[ind开发者_开发百科ex]).attr('eparts')));
})

When I click on this in FF and Chrome, my email clients starts and offers me a new email with the email address pre-populated.

However, with IE, in addition to opening my email client, a 2nd tab is opened with the email address only.

Can anybody tell me why that is that a 2nd tab opens with only the email address and how to prevent that from happening?

Thanks Eric


var e_values = $("a.envelope");
e_values.each(function(){
  $(this).attr('href','mailto:'+$(this).attr('eparts'));
})

should be enough - if you have target="_blank" on the links, remove that too

If IE opens a new browser, have a look here http://www.virtualdub.org/blog/pivot/entry.php?id=52

You are better off using a server side mailer than relying on the client having an email client correctly set up

No need to split mailto since a robot cannot guess the jQuery content

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜