Reputation: 10095
<a id="LnkEmail" onclick="doMailto('[email protected]');" href="javascript:void(0);">
<span id="LblEmail">ABC</span></a>
<script type="text/javascript">
function doMailto(EmailAddress) {
document.location.href = window.open('mailto:' + EmailAddress, 'new window');
}
</script>
Query - In IE 8 - Nothing happens on clicking it. Any Idea ?
Upvotes: 0
Views: 4332
Reputation: 78971
The mailing list is an utility features provided by Firefox only. You may or may not not find one software's feature on another similar one. If you don't, you should settle for a work around.
Try to remember that in firefox once the user selects a default mail client, you will not get the popup anymore. So there is no use of attempting to create a solution, that is not going to be permanent.
To trim down your requirement, you are trying to select the mail client of the user. But a website cannot changed the system settings of the user, its simply not allowed. Why? Because it opens many vulnerabilities to the user, if this was somehow allowed.
Upvotes: 0
Reputation: 8154
The popup selection feature is native to Firefox and is NOT an available feature in Internet Explorer, as Internet Explorer handles association directly from Windows, your operating system. So, whichever program is meant to handle mailto:
links on your computer is what will open (most typically, Outlook Express). There is no consistent way to avoid this as you cannot control what a user decides to open that protocol with. MY suggestion is to write a POST asp.net contact form. I'm not an ASP.NET developer myself, but I found this tutorial for you: http://www.jimcobooks.com/tutorials/emailform1/default.aspx
To test this theory: try finding a computer without any mail client (no outlook, outlook express, etc.) Internet Explorer will then prompt for a program to open the protocol.
Another test (the way I tested) I set up Google Chrome to handle all mailto:requests and forward them into my Gmail Webmail interface. When I tested your link, and modified your windowname in jsfiddle ( http://jsfiddle.net/sHYW8/2/ ), Windows asked me if IE could open Google Chrome to Handle the Protocol.
Short answer: what you ask is technically impossible unless you force all your users to install a third party addon for IE. This is the result of Internet Explorer being a part of the Windows Operating System, and Mozilla Firefox is a third party browser that is forced to handle protocols in its own way.
UPDATE
I found a jQuery plugin that uses the API for Gmail, Yahoo! and MSN. It's not a popup, but more of a rollover. I think this is going to be your closest bet.
http://kevin-cantwell.github.com/webmailto/
Good thing for you is that implementation seems easy enough. I would look at the bottom example, it looks pretty slick.
Upvotes: 9
Reputation: 281
Below is the working code as you mention
window.open('mailto:' + EmailAddress, 'newwindow');
its working but like FF IE not provide you option to choose mail engine. If you want to run your code you have to set the default program for mail using set default program. And you can set only Outlook as the default program. In out look you can bind any thing like yahoo or gamil that way you can use your mailto code for IE.
I think You have to doing coding for that because IE not provide any add on like FF.
For That first you have to chekc if default client mai lis there or not by following code
RegistryKey hkey = Registry.ClassesRoot.OpenSubKey( "mailto\shell\open\command", false);
if this key is null then no default client is there. so you have to show the mail provides list on popup. and selected provider you have to set as default client mail.
http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.classesroot(v=vs.90).aspx using above link you can find list of mailto registered on machine for list display.
http://www.pcreview.co.uk/forums/re-add-dword-value-registry-t1401434.html this link show how to set value in registry.
then execute your mailto code.
Upvotes: 0
Reputation: 26985
If you really want such a list there is a way with pure javascript although it might not be the exact same experience as you currently have in firefox. What you could do is create a modal dialog with javascript showing a number of popular webmail clients and an option "default system client" instead of "Microsoft Office Outlook". The "Choose an Application" would be impossible to include as well. Next, if the user selects the native client you would simply trigger a mailto link as you currently do and in case the user selects for example gmail you trigger a window open of a link along the lines of
with your own variables of course from your mailto link. You would have to figure out the relevant links for different webmail services yourself, but as far as I know, most have these kind of links and gmail and yahoo have for sure.
Upvotes: 0
Reputation: 151
try this:
function doMailto(EmailAddress) {
document.location.href = 'mailto:' + EmailAddress;
}
I think your IE is preventing pop up windows created by javascript.
Just to be clear...
Adriano's suggestion of just using a normal html tag would also work. Like this:
<a id="LnkEmail" href="mailto:[email protected]">
And as Vishal and Kyle Macey tried to explain: That "Launch Application" window that pops up in Firefox... that is not a window you can create from a web page. That is Firefox's own window that it shows when a mailto: link is clicked. IE does not offer the same type of window. It usually just opens your default mail client (in your case it would probably be Outlook).
and finally... Javascript is not the same as JQuery. JQuery is written in Javascript but JQuery is NOT Javascript.
Upvotes: 3
Reputation: 67080
For IE 7 and 8 only you can't use any space in the window name. Try to change your code to:
window.open('mailto:' + EmailAddress, 'Mail');
Upvotes: 1