alert() not working in Chrome

后端 未结 5 2247
南旧
南旧 2020-12-05 20:05

\"error\"

\'nuff said. I have absolutely no clue why using alert() there wouldn\'t work. It works perfectly in

5条回答
  •  情话喂你
    2020-12-05 21:08

    Here is a snippet that does not need ajQuery and will enable alerts in a disabled iframe (like on codepen)

    for (var i = 0; i < document.getElementsByTagName('iframe').length; i++) {
        document.getElementsByTagName('iframe')[i].setAttribute('sandbox','allow-modals');
    }
    

    Here is a codepen demo working with an alert() after this fix as well: http://codepen.io/nicholasabrams/pen/vNpoBr?editors=001

提交回复
热议问题