跳至內容
選單
此問題已被標幟
1 回覆
4476 瀏覽次數

Hi all,

during making my odoo site fully GDPR copliant I need to modify each and every iframe (and other tags like <script> as well) on the site like this example indicates:


Required changes to Iframe tags:

1.) Change the src="…" attribute of the iframe to data-cmp-src="…"
2.) Add a new src="about:blank" attribute to the iframe
3.) If a class="…" exists, add cmplazyload to the value. If class does not exist, add the attribute including the value class="cmplazyload"
 

Example code before change:

<iframe width="300" height="250" noresize="noresize" scrolling="no" 
    frameborder="0" marginheight="0" marginwidth="0"
    src="http://adserver.de/?x=1&y=2"
    ALLOWTRANSPARENCY="true">
</iframe>
Example code after change:

Example code after change:

<iframe width="300" height="250" noresize="noresize" scrolling="no"        
    frameborder="0" marginheight="0" marginwidth="0"        
    class="cmplazyload"        
    src="about:blank"     
    data-cmp-src="http://adserver.de/?x=1&y=2" 
      
    ALLOWTRANSPARENCY="true">
</iframe>

I went with the idea of using xpath expressions with the position="attribute" action type to do these modifications to all pages page.

But I found no sulution how to assign the value of an attribute to another attribute of the same node by using the <xpath> and <attribute> tags like this:

<xpath expr="iframe" position="attributes">
  <attribute name ="data-cmp-src"> <Value of attribute src of this iframe> </attribute>
</xpath>

How could that be achieved?
Using QWeb variables seem not to work inside <xpath> ..

Any other idea how to modify tags globaly like this?


Cheers
Stephan

頭像
捨棄
最佳答案

This looks hacky, but I think i know it can work. Am sure there should be better ways.

<xpath expr="iframe" position="attributes">
<attribute name="t-attf-data-cmp-src" add="#{'Value of attribute src of this iframe'}" separator=" "/>
</xpath>
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
1月 25
14591
1
8月 24
1888
2
2月 24
6847
1
6月 23
3075
1
1月 22
11734