推荐关注
› Meteor
› JSLint - a JavaScript code quality tool
› jsFiddle
› D3.js
› WebStorm
推荐书目
› JavaScript 权威指南第 5 版
› Closure: The Definitive Guide
flyn

求助,无法在 wixsite.com 上使用 document.write

  •  
  •   flyn · Jun 17, 2025 · 5132 views
  •   You need to sign in to view this topic
    This topic created in 524 days ago, the information mentioned may be changed or developed.

    我写了一个需要用到 document.write() 方法的 Bookmarklet ,但是在这个网站中无法正常使用,具体表现总是抛出错误 Uncaught TypeError: Cannot read properties of undefined (reading 'write')。

    已尝试通过新建 iframe 获取干净的 write 方法并绑定到顶层 document ,依旧无效。问 AI 也没有提供可行的解决方案。

    个人水平实在是有限,求助高手帮忙看看这网站用了什么魔法阻止使用这个方法,有解决的可能吗?

    siweipancc
    siweipancc
    Jun 17, 2025 via iPhone
    1
    append 然后 query?
    Fatinora
    Fatinora
    Jun 17, 2025
    2
    flyn
    flyn
    OP
    Jun 17, 2025
    3
    @siweipancc 我需要在新标签页中打开,新的页面监听 onload 事件,然后调用这些并不好使。
    @ns09005264 wixsite.com 没有配置 CSP 策略。
    SanjinGG
    SanjinGG
    Jun 18, 2025
    4
    新标签页操作原标签页吗?这个报错很明确吧,document 没有 write 方法,一步步调吧,看 document 是什么情况
    flyn
    flyn
    OP
    Jun 18, 2025
    5
    @SanjinGG 谢谢 已解决,网站重写了 window 对象,而我的注意力聚焦在 document
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4527 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 08:25 · PVG 16:25 · LAX 00:25 · JFK 03:25
    ♥ Do have faith in what you're doing.