Is there any way to prevent opening mail clients when address email being clicked? I got address email inside a div
<div class='run_function' >mymail@gmail.com </div>
The div is linked to javascript function on the desktop it works fine but on the mobile, it keeps opening Gmail. I tried to wrap it a tags without href attribute but it doesn't work.
If you are talking about clicking on mobile try adding read only attribute. I don't see your JS script but if this disabled the clink on desktop too then do a media rule and use classes to show one div to desktop users without this read only and one with too mobile users.
<div class='run_function' readonly >mymail@gmail.com </div>
Or try this:
@media only screen and (min-width: 800px) {
run_function {
*your code here*
}
}
Or:
<div class='run_function'>mymail<span>@</span>gmail.com </div>
Also read more: how to disable links .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.