Skip to Content
Menu
This question has been flagged
2 Replies
5502 Views

Odoo 11.0 (Community Edition)

Ubuntu 16.04.3 LTS (GNU/Linux 4.17.17-x86_64-linode116 x86_64)


I want to place the following:

<script type="text/javascript" id="script-loader" async defer src="//domain.tld/script.js"></script>

...before the closing </body> tag on the Website.  

How can I do this?  (Yes, it has to be in this specific place.)

Avatar
Discard
Best Answer

 I think this is the closest you will get without adding the script to the backend:

<template id="layout_inherit" inherit_id="website.layout">
        <xpath expr="//div[@id='wrapwrap']" position="after">
            <script type="text/javascript" id="script-loader" async defer src="//domain.tld/script.js"></script>
        </xpath>
    </template>
Avatar
Discard
Best Answer

Can you give a better explanation of where that code should be placed?

Avatar
Discard

This is normal qweb inheritance, so you would usually place this in a file called views/templates.xml.

Inside the <odoo><data> </data></odoo> tags.

Make sure you declare this file in the __manifest__.py

I am struggling to impliment livechat from a 3rd party within Odoo. The code I am trying to insert is below, but for the life of me I have been unable to accomplish this. It should be implimented right before the </body> on the HTML. Any help would be appricated!

<script type="text/javascript">

var $zoho=$zoho || {};$zoho.salesiq = $zoho.salesiq ||

{widgetcode:"##################################", values:{},ready:function(){}};

var d=document;s=d.createElement("script");s.type="text/javascript";s.id="zsiqscript";s.defer=true;

s.src="https://salesiq.zoho.com/widget";t=d.getElementsByTagName("script")[0];t.parentNode.insertBefore(s,t);d.write("<div id='zsiqwidget'></div>");

</script>

Related Posts Replies Views Activity
1
Dec 24
185
2
Mar 24
698
2
Mar 24
1331
0
Sep 23
354
1
Sep 23
461