.png)
要开始,请按照以下步骤操作::
Content.Design, click on Configuration.Default Store View) and click on Edit under the Action column.Edit Theme page, scroll down to the Other Settings section.HTML Head tab to expand it.Scripts and Style Sheets field, you can add your HTML code snippet.Save Configuration button located at the top right of the page.System from the admin sidebar.Tools, click on Cache Management.Flush Magento Cache.
Error: "Refused to load the script 'https://unpkg.com/weploy-translate/dist/weploy-translate.js' because it violates the following Content Security Policy directive: ."
1. Create or Edit the CSP Whitelist Configuration File
app/code/[Vendor]/[Module]/etc/csp_whitelist.xml. Replace [Vendor] and [Module] with your specific vendor and module names, e.g., Custom/Module.2. Edit the csp_whitelist.xml File
script-src and connect-src policies:<?xml version="1.0" encoding="UTF-8"?>
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
<policies>
<policy id="script-src">
<values>
<value id="globalseo" type="host">cdn.globalseo.ai</value>
<value id="globalseoapi" type="host">api.globalseo.ai</value>
<value id="unpkg" type="host">unpkg.com</value>
</values>
</policy>
<policy id="connect-src">
<values>
<value id="globalseo" type="host">cdn.globalseo.ai</value>
<value id="globalseoapi" type="host">api.globalseo.ai</value>
<value id="unpkg" type="host">unpkg.com</value>
</values>
</policy>
</policies>
</csp_whitelist>
3. Enable the Module (if it is a new module)
php bin/magento module:enable [Vendor]_[Module]
php bin/magento setup:upgrade
php bin/magento setup:di:compile
Replace [Vendor] and [Module] with your specific names.
4. Flush the Cache
php bin/magento cache:flush