콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
6371 화면

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>

관련 게시물 답글 화면 활동
3
2월 25
2033
1
12월 24
2139
2
3월 24
2469
2
3월 24
2996
0
9월 23
1559