我可以让 javascript 在另一个页面加载后自动点击该页面上的链接吗?
我想在页面 A 上创建一个链接到页面 B 的链接,并在页面 B 加载完成后单击页面 B 上的链接。这是可能的还是我必须在应该单击链接的特定页面上编写 JavaScript 代码。
I want to create a link on page A that links to page B and also clicks on a link on page B once page B has finished loading. Is this possible or would I have to code javascript on that specific page where the link is supposed to be clicked on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只是想重定向到另一个页面,您可以检查网站上的
document.referrer
以查看此人来自何处 (url),然后使用location.replace("http: //example.com/myformpage.htm")
If you simply want to redirect to another page you can check the
document.referrer
on your site to see where the person came from (url) and then redirect withlocation.replace("http://example.com/myformpage.htm")
你是对的,JS 几乎是在包含的环境(即原始页面)中运行的。
You're right, JS is pretty much run in contained environment (i.e., the original page).