Using anchor tag to open a mailto and invoke a URL

a 夏天 提交于 2019-12-01 02:24:24

问题


With one of my requirements i need to open up the default mailing client with invoking a call to a service, this needs to be accomplished using anchor tags or purely html, the constraint is that we can not use javascript for the same. Does anyone have any idea on how to accomplish this?


回答1:


try this:

<a href="mailto:test@test.com">Click to Mail</a>  

This will open default mailing client.

Edit :
You may use onClick function to open new window and call you webservice url in it.like

<a href="mailto:test@test.com" target="_blank" onclick="window.open('your WS URL');">Click to Mail</a>



回答2:


you can use like this

<a href="mailto:me@domain.com?subject=Call me&body=dummy mail:">
  touch here</a>

try it




回答3:


If you feel very very daring (and don't mind a horrible hack), you can try if

<meta http-equiv="refresh" content="1; url=mailto:foo@bar.baz" />

on your service page helps you. My brief check in FF suggests that since the new target starts an external program, the page doesn't go elsewhere. This might require some reshuffling of your service, depending on where exactly you want to spawn the mail window.



来源:https://stackoverflow.com/questions/20373420/using-anchor-tag-to-open-a-mailto-and-invoke-a-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!