如何在不同选项卡之间访问HTML元素 [英] How to access HTML elements between different tabs

查看:90
本文介绍了如何在不同选项卡之间访问HTML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

我有2台设备(假设它们是adsl调制解调器),我可以通过输入172.16.etc来访问他们的管理控制台。

现在我想创建一个只有一个名为激活所有系统的简单按钮的html文件

当用户点击它时,管理控制台网站的一些复选框(应打开另一个标签或窗口)应检查并点击一些按钮。

简而言之,有两个设备,他们的管理控制台有启动按钮,我想同时点击它们另一个html文件。



我尝试过:



我尝试过javascript并意识到同源政策限制了它。我想我设法禁用它但总体上没有成功。

Hi.
I have 2 devices (assume they are adsl modems) and i can reach their management consoles by typing 172.16.etc.
Now i want to create an html file having only one simple button with the name of "Activate all systems"
When user clicks on it, some checkboxes of management console websites (opened another tabs or windows) should be checked and some buttons should be clicked.
Briefly, there are 2 devices, their management consoles have "launch" buttons and i want to click them at the same time by another html file.

What I have tried:

I tried javascript and realised that "same origin policy" restricts it. i think i managed to disable it but have no success overall.

推荐答案

你想要一个网站打开另一个网站并点击该网站上的按钮和链接吗?出于非常明显的安全原因,这是不可能的。
Would you want a website opening another website and clicking buttons and links on that site for you? This isn't possible for pretty obvious security reasons.


你不能;正如FES Sitecore所说,这是一个安全问题。



浏览器设计用于隔离默认的分离标签,而Chrome具有> 60%的市场份额通过对每个标签使用不同的过程,使得向前迈出了一步 - FF和Edge也都在研究它。
You cannot; as FES Sitecore stated, this is a security concern.

Browsers are designed to isolate the separated tabs be default, and Chrome which has >60% of the market share takes has always taken it a step forward by utilizing different processes for each tab- FF and Edge are both looking into that as well.


使用 - disable-web-security 命令行开关 [ ^ ] 。这将禁用计算机上运行的Chrome实例的同源策略。



注意:不要浏览您的网站在这个环节中不要控制。



javascript - 在Chrome中停用相同的来源政策 - Stack Overflow [ ^ ]
Launch Chrome with the --disable-web-security command-line switch[^]. This will disable the same-origin policy for that instance of Chrome running on your computer.

NB: Don't browse sites that you don't control in this session.

javascript - Disable same origin policy in Chrome - Stack Overflow[^]


这篇关于如何在不同选项卡之间访问HTML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆