我在网站上有一小段代码通过电子邮件发送当前页面。它适用于Firefox但不适用于Chrome。我已经搜索了这个问题,但没有找到任何答案。我有什么不对的吗?
<script>
function emailCurrentPage(){
// In comments, other things I've tried
//window.location.href="mailto:?subject="+document.title+"&body="+escape(window.location.href);
//document.location.href="mailto:?subject="+document.title+"&body="+escape(document.location.href);
document.location="mailto:?subject="+document.title+"&body="+escape(document.location);
}
</script>
<button onclick="emailCurrentPage();">
Send by email
</button>
谢谢。
答案 0 :(得分:0)
更改您的功能:
window.location.href="mailto:?subject="+document.title+"&body="+encodeURI(document.location);