mailto causing a blank page in IE8 when used with Dojo
For some reason, in IE (IE8 in Win 7 to be precise), when I click on a mailto link, I end up with the current page being replaced by a blank page with mailto in the address bar.
Specifically, this is what happens when I click the mailto link:
- New about:blank tab opens and a security prompt pops up asking if I want to open Outlook. At this point, it looks like the original tab still is showing the original page.
- When I click "Allow" or "Don't Allow", the new tab closes and the original page is reloaded with the mailto in the address bar.
If I comment out the dojo.xd.js reference, it works as expected.
Firefox and Chrome just pop up the Outlook new message window. Also tested and works on Windows XP and IE7.
The code to replicate the issue is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>mailto test</TITLE>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.3.2/dojo/dojo.xd.js" djConfig="parseOnLoad: true"></script>
</HEAD>
<BODY>
<a href="mailto:example@example.com"&g开发者_开发技巧t;mailto</a>
</BODY>
</HTML>
Hello I have been investigating this problem here as well and it comes down to the extended security settings in ie8. The issue is the so called protected mode. Funnily if you have a page with a mailto link which has protected mode disabled and you have a mailto link and protected mode enabled for the internet, you run into this issue. IE tries to start the protected mode, and performs a page refresh by doing so against about: blank before starting the mail client. After that it tries to redirect to your original page and more often fails than is able to restore the page. In default settings you also get a security warning in between which you can disable with a checkbox. It all nails down to the problem to get the mailto link into the protected mode or to either disable the protected mode entire or to push your mailto page into the protected mode. The nastier issue even is that you cannot wildcard entire mailto links and if you add a generic domain wildcard ala *.example.com the mailto link mailto:myaddy@example.com still is not being recognized as part of the trusted domain. So I am not sure which strategy is the best to fix this, the best probably would be that Microsoft fixes their domain wildcarding system in the internet settings which still is the same as in IE.
Would you happen to be debugging this locally on you machine or is this problem on a site that is on the Internet? If you are debugging this site locally this problem arises because the site is in the "Local Intranet Zone" in IE and the mailto link is in the "Internet Zone". IE does not like this. Check out this link about the issue. MS Article. This problem will magically go away after the site is published to the Internet.
We just had the same issue, turning Protected Mode on fixes the problem. Also, shortening the content of the mailto link to less than 500 characters fixes the problem.
Your doctype isn't complete... change it to this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
If you create a hidden iframe with a name="foo" attribute, then put a target="foo" on the a tag for the link it should avoid the problem.
For whatever reason it seems to be working for me now.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
精彩评论