【发布时间】: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