如何正确的替换 HTML
算是私人页的一个 BUG ,之前没有注意到。使用 innerHTML 进行替换后,替换内容内所有的 script 都失效了,这是符合浏览器预期的,可见 MDN 。
Although this may look like a cross-site scripting attack, the result is harmless. HTML specifies that a <script> tag inserted with innerHTML should not execute.