This question is a little old, but I just went through this and I think I can help anyone looking for an answer in the future.
I ran into this problem because the website I was building had a built-in tracking system that tracked the URLs of outbound links for self-hosted ads. If I don't redirect, there is no way (without changing the way it was implemented) to track the click, since I'm not using an API or anything.
The easy fix was to do what you did, sending back an HttpResponse()
whose content is the meta tag
<meta http-equiv="refresh" content="0;url=mailto:youremail@test.com" />
This causes the page to refresh on load, which triggers the mailto:
action.
Now we're left with an open window, but we can't close the window using Javascript's window.close()
method. I do believe that this solution should work, however. Call that Javascript function after the refresh has been successful.
Unfortunately, I haven't tested this, but these two methods should accomplish a mailto:
redirect that does not leave a blank window/tab behind.
Hope this helps!