Skip to content

Instantly share code, notes, and snippets.

Created July 29, 2012 22:20
Show Gist options
  • Save anonymous/3202151 to your computer and use it in GitHub Desktop.
Save anonymous/3202151 to your computer and use it in GitHub Desktop.
Soundcloud iFrame Memory Leak
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Leak Tester</title>
</head>
<body>
<div id="container"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
var addFrame = function() {
console.log("Adding frame!");
$('.mixframe').remove();
var url = 'http://w.soundcloud.com/player/url=http://api.soundcloud.com/tracks/54453743&amp;show_artwork=true&amp;show_comments=false';
var iframe = $('<iframe>').attr('width', '100%')
.attr('height', 166)
.attr('scrolling', 'no')
.attr('frameborder', 'no')
.attr('src',url)
.addClass('mixframe');
$('#container').append(iframe);
};
setInterval(addFrame, 5000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment