Answer: Script Tag Not Executing Inside Shopify App Embed Block

nirmalsankalana

NirmalSankalana

Posted on November 2, 2024

Answer: Script Tag Not Executing Inside Shopify App Embed Block

After experimenting, I found that Shopify's strict Content Security Policy (CSP) blocks inline JavaScript in certain contexts. The best way to add JavaScript functionality in a Shopify App Embed Block is to:

  1. Move JavaScript code to a separate file in the assets directory of your theme.
  2. Reference the JavaScript file
💖 💪 🙅 🚩
nirmalsankalana
NirmalSankalana

Posted on November 2, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related