【问题标题】:jQuery $.ajax-Function - load iframe vimeo videojQuery $.ajax-Function - 加载 iframe vimeo 视频
【发布时间】:2014-01-18 15:49:18
【问题描述】:

大家好,我尝试以这种方式更改我的内容:

$("ul#nav li a").click(function(){
    var href = $(this).attr("id"); //getID in a String

    getContent(href);

    $("ul#nav li a").removeClass("active"); //Active
    var select = $("#" + href);
    select.addClass("active");
});

//getContent --- URL aufrufen
function getContent(href) {
    $.ajax({
        type : "GET",
        //url: href + ".html",
        //url : "http://localhost/ProVid/" + href + ".html",
        url: "http://webuser.hs-furtwangen.de/~lieneman/pages/" + href + ".html",
        //url: "http://webuser.hs-furtwangen.de/~lieneman/pages/vorstellung.html",
        dataType : "html",

        beforeSend : function(xhr) {
            xhr.overrideMimeType("text/html; charset=ISO-8859-1");
        },
        success : parseHTML,
        error : function(xhr, ajaxOptions, thrownError) {
            alert(xhr.status);
            $('#content').html("<h3 style='text-align: center;'>Es ist ein Fehler aufgetreten</h3>");
        }
    });
}

function parseHTML(html) {
    content = $(html).filter("#content").text();
    titel = $(html).filter("#title").text();
    video = $(html).filter("#video").text();

    $("#content").html(content);
    $("#title").html(titel);
    $("#video").html(video);
}

它只适用于普通的 HTML 内容。但我想加载 vimeo 视频 (iFrame)。

Der Nachbereitungs-Baustein

【问题讨论】:

    标签: jquery ajax iframe vimeo


    【解决方案1】:

    检查您的控制台,您是否看到以下内容:

    拒绝在框架中显示“http://vimeo.com”,因为它将“X-Frame-Options”设置为“SAMEORIGIN”。

    Vimeo 正在积极尝试通过将此标头添加到他们的所有回复https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options

    来阻止他们的网站显示在 iframe 中

    编辑: 我看到他们的标准嵌入代码使用 iframe,他们显然没有应用此限制,所以如果这是您使用的,那么这不会是您的问题的原因。

    【讨论】:

      猜你喜欢
      • 2017-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-11
      • 1970-01-01
      • 1970-01-01
      • 2015-11-04
      • 1970-01-01
      相关资源
      最近更新 更多