首页 > 解决方案 > 是否可以将输入的值从我的网站传递到互联网上的任何其他网站

问题描述

是否可以将输入的值从我的网站传递到互联网上的任何其他网站。我已将输入保存到本地存储。现在我想将它传递到另一个需要用户名的网站。另一个网站的输入 ID="userusername"。如果网站不期望使用例如 POST 或 GET 方法发布的值,是否有可能?

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>

<script type="text/javascript">

    function passvalues(){
        var pass=document.getElementByID("name").value;
        localStorage.setItem("textvalue", pass);
        return false;
    }

</script>

<form method="POST" action="whatever website">
    <input type="name" placeholder="Name" id="name"/>
    <input type="submit" placeholder="Login" onclick="passvalues();"/>
</form>

</body>
</html>

标签: javascripthtmlpostlocal-storage

解决方案


LocalStorage 仅限于指定页面的协议,因此您可以使用 post 方法将本地存储的数据传递到另一个网站。但是,如果您的页面协议发生变化,情况就不会如此。


推荐阅读