是否可以为JS/PHP提供某个页面的链接地址,并使其访问或使用它做一些事情
我想下载一个页面的内容,将该地址输入到表单中。所以我会创建一个表格,在那里输入一个页面地址,比如Google.com
<label>Enter address of a page you want me to visit</label><input type="text" id="pageAddress">
在JS/PHP到达那里之后,它会在站点控制台中运行这样的功能:
(function(){
document.location =
'data:text/attachment;base64,' +
utf8_to_b64(document.documentElement.innerHTML); //To Download Entire Html Source
})();
function utf8_to_b64( str ) {
return window.btoa(unescape(encodeURIComponent( str )));
}
所以整个脚本可以访问我想要的页面并下载它的内容。有可能吗?
您可以在javascript中使用window.location.assign("url here");
。