Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix error from mailto link within iframe

I am creating a webpage with a mailto link inside an iframe. I get an error when clicking on this link. The error does not occur when I put the mailto link outside the iframe. It might relate to gmail being my default mail handler, but I want the link to work for gmail users, and of course also for users of other email clients. How can I fix this?

Here's the relevant content from the .html file that goes into the iframe:

<a target="_parent" href="mailto:[email protected]">Contact XXX</a>

And here's the error message.

Load denied by X-Frame-Options: https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/?extsrc%3Dmailto%26url%3Dmailto:[email protected]&scc=1&ltmpl=default&ltmplcache=2 does not permit framing.

If it's relevant, I'm testing on Firefox, but of course I'd like a cross-browser solution.

like image 546
baixiwei Avatar asked Dec 18 '25 04:12

baixiwei


2 Answers

  1. Change to target="_blank" to open a new tab;
    <a target="_blank" href="mailto:[email protected]">Contact XXX</a>
  1. Allow gmail to handle "mailto":
    • Use chrome to access gmail.com;
    • Look at the right-side of the address bar for the Protocol Handler icon;
    • Click above icon, and choose "allow" option;
like image 154
King Cao Avatar answered Dec 19 '25 21:12

King Cao


I also had same issue within iframe . you can just add following code onclick event of element for open mailto window

window.top.location='mailto:[email protected]';

this will open your mailto window within iframe

like image 40
Nisar Saiyed Avatar answered Dec 19 '25 20:12

Nisar Saiyed