Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
6295 Переглядів

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.)

Аватар
Відмінити
Найкраща відповідь

 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>
Аватар
Відмінити
Найкраща відповідь

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

Аватар
Відмінити

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 Відповіді Переглядів Дія
3
лют. 25
1817
1
груд. 24
2003
2
бер. 24
2357
2
бер. 24
2882
0
вер. 23
1449