Skip to Content
Menu
This question has been flagged

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

Avatar
Discard
Best Answer

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>
Avatar
Discard
Related Posts Replies Views Activity
1
Aug 24
318
2
Feb 24
5294
1
Jun 23
1821
1
Jan 22
10552
3
Sep 21
5577