即时通讯显示随机嵌入链接存储在数据库中。这些嵌入链接到mixcloud.com和soundcloud.com服务器上的一些音乐。但用户可以删除他们的音乐,因此其中一些嵌入可能会变得不起作用。例如,我的数据库中嵌入了这个mixcloud:
<iframe frameborder="0" height="200"
src="//www.mixcloud.com/widget/iframe/?feed=http%3A%2F%2Fwww.mixcloud.com%2Fmeik-sebastien-muller%2Fclickclack%2F&
embed_uuid=3064105d-9dbc-4907-b999-8c7076a19ca8&
stylecolor=&
embed_type=widget_standard&
hide_cover="
width="480">
</iframe>或soundcloud embed:
<iframe frameborder="no" height="166" scrolling="no"
src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F86361501&
show_artwork=true"
width="100%">
</iframe>有没有什么方法可以检查服务器上的音乐是否仍然存在,这样如果音乐已经被删除,我可以从数据库中选择另一个嵌入?
发布于 2014-03-02 21:52:13
我认为使用api是可能的,
$.getJSON("https://api.soundcloud.com/tracks/86361501?client_id=0f8fdbbaa21a9bd18210986a7dc2d72c&format=json").error(function() {
alert("ups, there is an error, that track is not available");
})https://stackoverflow.com/questions/22128344
复制相似问题