Unchecked runtime.lastError while running tabs.executeScript: Cannot access contents of url “data:text/html,chromewebdata”

前端 未结 1 808
無奈伤痛
無奈伤痛 2021-01-21 07:12

I\'m getting this error:

extensions::lastError:133 Unchecked runtime.lastError while running tabs.executeScript: Cannot access contents of url \"data:text/html,c         


        
相关标签:
1条回答
  • 2021-01-21 07:24

    Indeed, the "Offline" page, or any other error page shown is treated as a Chrome internal page instead of its "original" URL. As such, you can't inject into such pages to change them for security reasons. Imagine for a moment that an extension would be able to interact with SSL warning pages - you really, really don't want that.

    If your goal is to provide some sort of alternative error page, you need to hook a listener for such navigation errors and redirect to your own page.

    I would recommend looking at webNavigation and webRequest API.

    0 讨论(0)
提交回复
热议问题