- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016
03:27 AM
02-23-2016
03:27 AM
Adding script before closing body tag
As the title says I'm trying to add some script before the closing body tag.
So far I have created my own vendor/theme and am referencing the magento theme module.
I have;
/my-vendor/my-theme/Magento_Theme/layout/default.xml
which contains;
<referenceContainer name="before.body.end"> <block class="\Magento\Framework\View\Element\Template" template="Magento_Theme::templates/html/js.phtml" name="modulejs"/> </referenceContainer>
and I have /my-vendor/my-theme/Magento_Theme/templates/html/js.phtml which contains my script.
Pretty new to this so no idea if this is nearly right, it's pieced together from various bits I have found.
Thanks
Labels:
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016
08:15 AM
02-23-2016
08:15 AM
Re: Adding script before closing body tag
How to add a JavaScript at a Magento 2 page's end (before the closing </body> HTML tag)? https://mage2.pro/t/811
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016
08:34 AM
02-23-2016
08:34 AM
Re: Adding script before closing body tag
? That does not help