Ignored call to 'alert()'. The document is sandboxed, and the 'allow-modals' keyword is not set

后端 未结 2 1930
感动是毒
感动是毒 2020-12-10 13:05

Whenever running alert(\'something\') in JSFiddle, I get the error:

Ignored call to \'alert()\'. The document is sandboxed, and the \'all

2条回答
  •  -上瘾入骨i
    2020-12-10 13:46

    IFrame sandboxing is a technique that helps protect from outside content creating confusing popups that would appear to come from the main website. To allow alert popups you will need to find the iframe tag, and modify the sandbox attribute to contain the allow-modals value. For JSFiddle this is the iframe named "result". You will need to Re-Run (ctrl-enter) your Fiddle after modifying the tag.

    Using web browser Developer Tools or something like Grease Monkey/Tamper Monkey change the iframe.

    From this: