【问题标题】:Google Drive Save button Text Editing - Cross Domain iframe editGoogle Drive 保存按钮文本编辑 - 跨域 iframe 编辑
【发布时间】:2014-12-28 21:18:00
【问题描述】:

我正在尝试编辑跨域 iframe。具体来说,我想更改谷歌驱动器保存按钮中显示的文本。

https://developers.google.com/drive/web/savetodrive这是我要编辑的内容。

$(".gdrivelink iframe").contents().find(".save-to-drive-text").text('Save to Google Drive');

我在尝试运行文本更改代码时收到此错误。

DOMException {message: "Failed to read the 'contentDocument' property from…92.168.2.27" from accessing a cross-origin frame.", name: "SecurityError", code: 18, stack: "Error: Failed to read the 'contentDocument' proper…ject.InjectedScript.evaluate (<anonymous>:609:21)", INDEX_SIZE_ERR: 1…}code: 18message: "Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "xxxx://192.168.2.27" from accessing a cross-origin frame."name: "SecurityError"stack: "Error: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "192.168.2.27" from accessing a cross-origin frame.
    at Error (native)
    at n.each.contents (192.168.2.27/zm/js/jquery.js:2:26312)
    at Function.n.extend.map (192.168.2.27/zm/js/jquery.js:2:3483)
    at n.fn.(anonymous function) [as contents] (192.168.2.27/zm/js/jquery.js:2:26401)
    at <anonymous>:2:25
    at Object.InjectedScript._evaluateOn (<anonymous>:762:137)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:695:34)
    at Object.InjectedScript.evaluate (<anonymous>:609:21)"__proto__: DOMException

我已经搜索过了,但找不到解决方法。

【问题讨论】:

    标签: javascript jquery iframe google-drive-api cross-domain


    【解决方案1】:

    由于严重的安全问题,这是不可能的。由于 JavaScript 被大量用于网络钓鱼,每个页面都在沙箱中运行,只有它需要的权限。由于 iframe 只是另一个页面中的一个页面,因此应用了限制。

    假设您打开了两个选项卡,一个是网上银行,另一个是“邪恶”。如果邪恶网站能够在银行网站内填写表格并通过 javascript 提交这些表格怎么办?

    【讨论】:

    • 感谢您的回复 :) 我会投票,但我不能,因为我的帐户没有任何代表 :( 我想了很多 :( 我真的希望有人找到工作周围。我发现这里的人在从其他域动态加载的内容方面变得非常狡猾。更可能的是,我没有看到直接加载到页面的东西,而不是在 iframe 中。我想是第一世界的问题。 :(
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-09
    • 1970-01-01
    • 2018-08-07
    • 2019-01-08
    • 2019-05-25
    • 2015-07-21
    • 1970-01-01
    相关资源
    最近更新 更多