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?
Using anchor tag to open a mailto and invoke a URL
try this:
<a href="mailto:[email protected]">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:[email protected]" target="_blank" onclick="window.open('your WS URL');">Click to Mail</a>
Yes this is only working to open mail client but also i need to invoke a URL –
Kamerad
@Kamerad without javascript an anchor tag can only have a single click action. It cannot perform two things at once. –
Cotta
@Cotta is right. you need to use JavaScript to do both thing in one click. –
Mingle
this is a part of a mail which my program sends and all mailing clients DONOT support javascript hence the limitation is to use HTML tags only –
Kamerad
@Kamerad i have add some code. it will use onCick event to call your ws by passing url to new window. –
Mingle
@Yagnesh
onClick
is a javascript event ;-) –
Cotta @Cotta than you should think about to place two link. –
Mingle
you can use like this
<a href="mailto:[email protected]?subject=Call me&body=dummy mail:">
touch here</a>
try it
This would just open up the mail client i need to invoke a ws as well on the click –
Kamerad
@Kamerad better use jscript with it –
Undercast
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:[email protected]" />
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.
© 2022 - 2024 — McMap. All rights reserved.
<a href="mailto:..."></a>
? – Cotta