Chrome Extension - Sandbox pages in Manifest V3 prevent external URLs from loading

87 Views Asked by At

To program my Chrome extension I need external scripts, which is why I defined them using the content_security_policy and sandbox pages. As soon as I did that, it was no longer possible to navigate between the sandbox pages because Chrome blocked them.

manifest.json:

"sandbox": {
        "pages": ["dashboard.html", "settings.html"]
       },
       "content_security_policy": {
        "sandbox": "sandbox allow-scripts; script-src 'self' https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js https://kit.fontawesome.com/aed6fb8201.js"
       }

dashboard.html:

<ul>
            <p class="nav-desc">MAIN MENU</p>
            <li><a class="active" href="dashboard.html">
                    <i class="fas fa-gauge"></i>
                    <p> Dashboard</p>
                </a>
            </li>
            <li><a class="#" href="settings.html">
                <i class="fas fa-gear"></i>
                <p> Einstellungen</p>
            </a>
        </ul>

Error Message: When Clicking "Einstellungen" to navigate to the settings.html enter image description here

this error appears:

enter image description here

I tried other urls like google.com and this works. It looks like everything that isnt inside the sandbox pages array works

Any solutions to the problem? Thank you!

1

There are 1 best solutions below

3
Olivier On

Pretty sure this is just prohibited and even if you find a way to get this to work you will most likely not be allowed to publish in the store. Or, in other words, just download the scripts and include them in the bundle.