Home

Issue: 1369

js code added to head.script with innerhtml is always encoded

[issue link]

According to the vue-meta documentation it should be possible to add javascript to a script tag with innerHTML. But when I try this in the index.js of a plugin, the resulted js code is always encoded:

let config_js = '_paq.push(["setTrackerUrl", "' + (options.trackerUrl || options.piwikUrl+'piwik.php') + '"]);'
config_js += '_paq.push(["setSiteId", "' + options.siteId + '"])'
this.options.head.script.push({ 
  innerHTML: config_js, type: 'text/javascript'
})

results in:

<script data-n-head="true" type="text/javascript">_paq.push([&quot;setTrackerUrl&quot;, &quot;//piwik.example.com/piwik.php&quot;]);_paq.push([&quot;setSiteId&quot;, &quot;1&quot;])</script>

See #1330 for a use case

This question is available on Nuxt.js community (#c1212)