Salesforce

Manually Rewriting iFrames in Cookie Consent

« Go Back
Information
Manually Rewriting iFrames in Cookie Consent
UUID-3dc06342-ff6b-3578-5024-6d7c05d03283
Article Content

iFrames can be rewritten in a manner similar to the JavaScript method.

To Implement iFrame Rewriting

Given the typical iFrame:

<iframe src="https://www.youtube.com/yourvideo"></iframe>
  1. Change src attribute to data-src.

  2. Add class="optanon-category-[Category ID]" with [CategoryID] replaced with the appropriate cookie category ID for the iFrame.

The end result will be:

<iframe data-src="https://www.youtube.com/yourvideo" class="optanon-category-[Cookie ID]"></iframe>

The OneTrust script will now rewrite this iFrame to the correct src attribute and will only load the iFrame after consent is given.

To find your Cookie Category IDs, see Finding the Cookie Group IDs.

 
 
 
Article Visibility
34,456
Translation
English
Checked

Powered by