JSFiddle - React, Tailwind, and code Playground

by velo_ninja

HTML

<script>
  function config_iFramePermissions() {
    setTimeout(function () {
      var iframes = document.querySelectorAll("iframe");
      console.log(iframes);

      if (iframes.length > 0) {
        console.log(iframes.length + ' iFrames gefunden');
        var targetIframe = iframes[0];
        console.log('Haupt-iFrame: ', targetIframe);

        console.log('----setting access-----');
        setTimeout(function () {
          // Überprüfen, ob das "allow"-Attribut bereits vorhanden ist, und es aktualisieren oder hinzufügen
          var currentAllow = targetIframe.getAttribute("allow");
          var newAllow = "microphone; camera";

          if (currentAllow) {
            targetIframe.setAttribute("allow", currentAllow + "; " + newAllow);
          } else {
            targetIframe.setAttribute("allow", newAllow);
          }
        }, 3000);

        var parentElement = targetIframe.parentNode;
        parentElement.appendChild(targetIframe);
      }

    }, 3000);
  }

  // Die Funktion wird aufgerufen, um die Berechtigungen nach einer Verzögerung von 3 Sekunden zu konfigurieren
  config_iFramePermissions();
</script>