【问题标题】:How to check validity of the embed link如何检查嵌入链接的有效性
【发布时间】:2014-04-03 09:56:02
【问题描述】:

我正在显示存储在数据库中的随机嵌入链接。这些嵌入链接到 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&amp;
embed_uuid=3064105d-9dbc-4907-b999-8c7076a19ca8&amp;
stylecolor=&amp;
embed_type=widget_standard&amp;
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&amp;
show_artwork=true" 
width="100%">
</iframe>

有什么方法可以检查服务器上的音乐是否还在,如果音乐已经被删除,我可以从数据库中选择另一个嵌入?

【问题讨论】:

    标签: javascript php embed soundcloud


    【解决方案1】:

    我认为使用 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");
    })
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-12
    • 1970-01-01
    • 2012-02-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-26
    相关资源
    最近更新 更多