0

i need to add the following in the admin section head tag:

<link rel="manifest" href="/manifest.json" />
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
<script>
  var OneSignal = window.OneSignal || [];
  OneSignal.push(function() {
    OneSignal.init({
      appId: "xxxxxxxxxxxxxxxxx",
    });
  });
</script>

i know how to add local scripts , but any idea how to add remote scripts?

2

Try below code in your layout file:

<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" src_type="url"/>
    </head>
</page>
  • THAAAAANK UUU U – Zorox May 14 '18 at 13:57
0

This will working in 2.2.2 or updated versions.

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="vendor-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Your Title</title>
        <css src="Namespace_Modulename::css/component.css"/>
        <link src="Namespace_Modulename::js/custom-file-input.js"/>
    </head>
    <body>
        <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">Your Title</argument>
            </action>
        </referenceBlock>
    </body>
</page>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.