我理解的这个安全隐患,为什么我得到的错误是这样的:沟通与单独的Chrome标签
Uncaught DOMException: Blocked a frame with origin
"http://myurl.com" from accessing a cross-origin frame.
所以我不知道如果有,我做这一个安全的方式。
有两个网站内部我公司 - 我的,另外一个,做在同一个域不存在。
在我的页面中,我有兴趣加载第二页,让我可以从该页面访问ID元素,获取这些ID元素包含的数据,并将该数据返回到我的页面,这样我就可以将其显示给我的用户。我没有API来从第二个来源获取这些数据。最终,如果我还有一种方法可以将数据返回到源页面,我会很喜欢它,但是注射和攻击的风险一般很大,我怀疑有什么办法可以做到,甚至尽管我的意图不是恶意的。
我试过几件事情:
/* Literally load the page within my own and pull data once it's loaded */
$('#test').load('url.com/site2');
/* load the second page as a variable, then try to access an id on
that page through the variable */
var win = window.open('url.com/site2');
var test = win.getElementByID('#id_element_i_want_to_pull');
/* I can do something using PHP, but this just loads the page, but doesn't allow
me to access any of the ID elements on that page which
doesn't really help me: */
$temp = file_get_contents('url.com/site2');
有什么办法去了解呢?我没有权限访问第二台服务器上的代码,因此,如果需要的话,我可能无法(或许)将代码放在那里,这样我就可以访问这些代码。如果这是唯一的方法,我至少想知道它,并知道如何才能完成这种类型的请求。