Can I get javascript to automatically click on a link on another page once that page loads?

亡梦爱人 提交于 2019-12-13 07:44:42

问题


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.


回答1:


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 with location.replace("http://example.com/myformpage.htm")




回答2:


You're right, JS is pretty much run in contained environment (i.e., the original page).



来源:https://stackoverflow.com/questions/7047746/can-i-get-javascript-to-automatically-click-on-a-link-on-another-page-once-that

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!