Question

I have a mailto link on a page. It works as expected when the page is loaded by itself.

However when the page is loaded via a frameset in Chrome nothing happens. With the developer tools loaded the error "[blocked] The page at https://mysite.com ran insecure content from mailto:..." is displayed.

How can I fix/workaround this?

Was it helpful?

Solution 2

I also had this issue recently with an iframe. Using the top frame worked and should be compatible with all major browsers.

window.top.location = 'mailto:...';

OTHER TIPS

Yes, using "top" is the trick, but you can do it with HTML alone!

<a target="_top" href="mailto:...">email</a>

Here is the solution I ended up with: Tested with Chrome, Firefox, IE6, IE7, IE8, IE9, IE10, IE11, Safari

$("a[href^='mailto:']").on("click",function() {
    window.top.location = $(this).prop("href");
    return false;
});

add target="_top" or "_blank" or "_parent"

<a target="_top" href="mailto:a@b.c">email1</a>

<a target="_top" href="mailto:a@b.c">email2</a>

This will also work, and won't close the window with Facebook.

<a href="mailto:..." target="_blank">...</a>

or

$("a[href^='mailto:']").attr('target','_blank');

Possibly because your parent frameset is https, but Chrome now seems to treat the mailto link as insecure.

I just came across a similar issue when triggering a mailto link via

window.location = 'mailto:...'

Changing it to this worked around it.

window.open( 'mailto:...')

This is my workaround until Chrome bug is fixed:

$.browser.chrome = /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); 

if($.browser.chrome){
     myWindow=window.open("mailto:"+eml+"?subject="+msb,'','width=50,height=50');
     myWindow.close();
} else {
    window.location.href = "mailto:"+eml+"?subject="+msb;
}

For Chrome, make instance with window.open() method and close that instance immediately. Small window will "blink" for a short period but will do the job. It is "dirty" solution but as much as Chrome's bug.

For other browsers window.location() method can be used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top