我正在使用的代码是
window.location.href = "https://www.google.com/";
但我停留在同一页面,没有转到google.com .我能够通过 http 页面完成这项工作。
window.location.href = "http://www.tutorialspoint.com/mongodb/mongodb_insert_document.htm";
这是相同的完整代码
<form name="form1" onsubmit="submis()" action="/post.php" method="POST"
和函数submis()
function submis()
{
window.location.href = "https://www.google.com/";
}
和 post.php
if (!empty($_POST))
{
//saving the contents of the post request to a file.
}
最佳答案
<script>
function goto(){
window.location.href = "https://www.google.com/";
}
</script>
在html代码中<a href="#" onclick="goto()">go to google</a>
有效
关于javascript - 如何通过单击按钮打开 https 网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33405850/