是否有办法让页面打开mailto
链接并立即关闭打开该链接的页面?现在我有以下代码:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.location.href = "mailto:[email protected]";
</script>
</head>
<body>
<a href="mailto:[email protected]">Test</a>
</body>
</html>
当我导航到该页面时,邮件客户端已打开,但随后该页面保持打开状态,这是我不希望的。
<html>
<head>
<script type="text/javascript">
//window.location.href = "mailto:[email protected]";
function openClose(url){
newTab = window.open(url)
newTab.close() // Automatically close the tab when email client starts
}
</script>
</head>
<body>
<a onclick="openClose('mailto:[email protected]')" href="#">Test</a>
</body>
</html>