Skip to main content

Magento2 Magento 2: How to load my custom js file after footer?

JS File Path: web->js->swap.js web->js->swap.js

default_head_block.xml

    <referenceContainer name="before.body.end">
        <block class="Magento\Framework\View\Element\Text" name="swapjs">
            <arguments>
                <argument name="text" xsi:type="string"><![CDATA[<script type="text/javascript" src="js/swap.js"></script>]]></argument>
            </arguments>
        </block>
    </referenceContainer>

File path not found 404 error404 Error. Please help me into solve this issue.

Magento2: How to load my custom js file after footer?

JS File Path: web->js->swap.js

default_head_block.xml

<referenceContainer name="before.body.end">
    <block class="Magento\Framework\View\Element\Text" name="swapjs">
        <arguments>
            <argument name="text" xsi:type="string"><![CDATA[<script type="text/javascript" src="js/swap.js"></script>]]></argument>
        </arguments>
    </block>
</referenceContainer>

File path not found 404 error. Please help me in this

Magento 2: How to load my custom js file after footer?

JS File Path: web->js->swap.js

default_head_block.xml

    <referenceContainer name="before.body.end">
        <block class="Magento\Framework\View\Element\Text" name="swapjs">
            <arguments>
                <argument name="text" xsi:type="string"><![CDATA[<script type="text/javascript" src="js/swap.js"></script>]]></argument>
            </arguments>
        </block>
    </referenceContainer>

File path not found 404 Error. Please help me to solve this issue.

Source Link
Masud Shaikh
  • 1.2k
  • 22
  • 53

Magento2: How to load my custom js file after footer?

JS File Path: web->js->swap.js

default_head_block.xml

<referenceContainer name="before.body.end">
    <block class="Magento\Framework\View\Element\Text" name="swapjs">
        <arguments>
            <argument name="text" xsi:type="string"><![CDATA[<script type="text/javascript" src="js/swap.js"></script>]]></argument>
        </arguments>
    </block>
</referenceContainer>

File path not found 404 error. Please help me in this