Created
February 2, 2012 14:24
-
-
Save mataspetrikas/1723694 to your computer and use it in GitHub Desktop.
Converting HTML links to SoundCloud widgets using JQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if you have a link in your HTML that points to a sound: <a href="http://soundcloud.com/matas/hobnotropic">My Track</a> | |
// it will convert them to our new HTML5 widgets | |
$('a[href*="soundcloud.com"]').each(function(){ | |
var $link = $(this); | |
$.getJSON('http://soundcloud.com/oembed?format=js&url=' + $link.attr('href') + '&iframe=true&callback=?', function(response){ | |
$link.replaceWith(response.html); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This version works on HTTPS / SSL sites: