Element 'script': Character content is not allowed, because the content type is empty. Line:xxx

magento.stackexchange https://magento.stackexchange.com/questions/207764

Вопрос

I am running my custom plugin in Magento 2.2.2 fresh install.

I have customised Magento search page. When I hit search page then below error comes.

enter image description here

It's working perfectly in Magento 2.1 and 2.2.0 but not working in Magento 2.2.2.

Below is the code which I am using.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="Vendor_ModuleName::js/timer.js" type="text/javascript"></script>
    </head>
    <body>
        <referenceBlock name="search_result_list" template="Vendor_ModuleName::product/list.phtml">
        </referenceBlock>
    </body>
</page>
Это было полезно?

Решение

I have solved this issue by changing below line.

<script src="Vendor_ModuleName::js/timer.js" type="text/javascript"></script>

change with

<script type="text/javascript" src="Vendor_ModuleName::js/timer.js"/>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с magento.stackexchange
scroll top