简体   繁体   中英

block popups from iframe/embed

I have a lot of iframes and they are from spotify and I keep getting pop ups that ask for the content of the device which will cause one embed/iframe to pause when another one stops. How can I get all the iframes to not allow popups? This is just a small snippet of what I have:

my site can be found here: https://50izac02.github.io/sb/music.html

 <script> var songs1 = [ "https://open.spotify.com/embed/track/1K9QXJtypYRMVrfHixmHh3", "https://open.spotify.com/embed/track/7clyJIrLkEbXUDwj1tC9zz", "https://open.spotify.com/embed/track/0AB5CTb04eqXnV9hEZx9FL", "https://open.spotify.com/embed/track/31G6jTLEpHwGs3vpQ7iUJM"]; document.getElementById("spot1").src = songs1[Math.floor(Math.random() * 4) + 0]; var songs2 = [ "https://open.spotify.com/embed/track/1BlqKx3JtMKY3K6F0uUbqW", "https://open.spotify.com/embed/track/7h2yzh9vIBxSBN3885QyQt", "https://open.spotify.com/embed/track/4EAV2cKiqKP5UPZmY6dejk", "https://open.spotify.com/embed/track/5dqrgmHHBuUzwYKBXJuIm0" ]; document.getElementById("spot2").src = songs2[Math.floor(Math.random() * 4) + 0]; var songs3 = [ "https://open.spotify.com/embed/track/5dqrgmHHBuUzwYKBXJuIm0", "https://open.spotify.com/embed/track/6QyBWey7P8ILuhS5RO7xYe", "https://open.spotify.com/embed/track/5qrSlOut2rNAWv3ubArkNy", "https://open.spotify.com/embed/track/0TN3FKCgNsck8Z0t463bU0", ]; document.getElementById("spot3").src = songs3[Math.floor(Math.random() * 4) + 0]; var songs4 = [ "https://open.spotify.com/embed/track/5IcpFfoUZLU3G7b8BtppFi", "https://open.spotify.com/embed/track/4R8RG1OWtp0ahfyGUcD76M", "https://open.spotify.com/embed/track/6IHWepcSxwLdzM38nQSrnC", "https://open.spotify.com/embed/track/6JyuJFedEvPmdWQW0PkbGJ",]; document.getElementById("spot4").src = songs4[Math.floor(Math.random() * 4) + 0]; var songs5 = [ "https://open.spotify.com/embed/track/41n0s0MdHk3SQYrJ4djpXb", "https://open.spotify.com/embed/track/3uKxSYyWgMqu9LrgC2Lo7v", "https://open.spotify.com/embed/track/0e9yz3Fz7Nn6I5E4XBP8no", "https://open.spotify.com/embed/track/4hPpVbbakQNv8YTHYaOJP4", ]; document.getElementById("spot5").src = songs5[Math.floor(Math.random() * 4) + 0];
 <div id="row 1"> <iframe id="spot1" src="" width="250" height="90" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe> <iframe id="spot2" src="" width="250" height="90" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe> <iframe id="spot3" src="" width="250" height="90" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe> <iframe id="spot4" src="" width="250" height="90" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe> <iframe id="spot5" src="" width="250" height="90" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe> </div>

You could sandbox the iframe with: sandbox="allow-scripts". That should stop them from producing popups.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM