[英]How to check validity of the embed link
我會顯示存儲在數據庫中的隨機嵌入鏈接。 這些嵌入鏈接到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嵌入:
<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>
有什么方法可以檢查服務器上的音樂是否仍然存在,所以如果音樂已被刪除,我可以從數據庫中選擇另一個嵌入?
我認為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");
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.