Data privacy: Altering markup of src attribute in all occurrences of the iframe element

Data privacy: Altering markup of src attribute in all occurrences of the iframe element

'mei a Alexander Lebeth - 'aho
Number of replies: 1

Due to data privacy concerns, the university I am working for has to prevent the loading of iframe sources (embedded in Atto text fields for example) on initial page load and instead offering the user a kind of a cookie consent manager by which it's possible to give consent to third party cookies associated with iframe content and then loading the iframe.

The theoretical approach is altering all occurences of the iframe src attribute to data-src, so iframes sources aren't loaded at initial page load and then, after users consent, loading iframe sources by javascript.

So my question is: how can we alter all occurences of iframe's src attribute in moodle?

Thanks!

Average of ratings: -
In reply to Alexander Lebeth

Re: Data privacy: Altering markup of src attribute in all occurrences of the iframe element

'mei a Mark Sharp - 'aho
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Not something I've tried, but perhaps a filter will do it. Filters preprocess html to change the output. For example, taking a url and making it a clickable link. You may find there are some filters that might convert a url to an iframe e.g. a youtube url will be converted into an iframe, so you would need to run your filter after that filter.