简体   繁体   English

如何单击重定向页面上的按钮?

[英]How to click a button on a redirected page?

I have the following code on my initial page 我的初始页上有以下代码

<html ..
<script> 

<input type= "button" onClick="location.href('http:www.google.com')">

How can I click the OK button on the google page ones redirected using ONLY javascript. 我如何单击仅使用javascript重定向的Google页面上的“确定”按钮。 Is it possible ? 可能吗 ?

No, once the user has been redirected away from your website, you cannot access the DOM any longer using JavaScript. 否,一旦将用户重定向到您的网站之外,您将无法再使用JavaScript访问DOM。

You could achieve something like this using a Chrome Plugin or some such, but thankfully this is not possible using native JavaScript code. 您可以使用Chrome插件或类似工具来实现类似目的,但是幸运的是,使用本机JavaScript代码无法实现。

我不知道为什么要单击Google页面上的“确定”按钮,但是如果要启动搜索,为什么不尝试使用以下搜索参数进行重定向: https : //www.google.ca/#q=google +搜索+ javascript

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM