Skip to main content

Force iframe titles

This script in the advanced body section will give generic names to all iframes on the site if they do not already have one.

// Gives all iframes a generic title
<script type="text/javascript">
    window.onload = function() {
        const iframes = document.querySelectorAll('iframe');
        let iframeCount = 0;

        iframes.forEach(function(iframe) {
            if (!iframe.title) {
                iframeCount++;
                iframe.title = "generic_iframe_" + iframeCount;
            }
        });
    };
</script>