0

我有一个 https 网站。我在 Tomcat 上运行 LifeRay。我正在使用以下网址:

http://gdata.youtube.com/feeds/api/videos/ID?v=2&alt=jsonc

jQuery.ajax({
    url: URL,
    dataType: 'jsonp',
    async: false,
    success: function (obj) {
        processData(obj);
    }
});

获取数据然后处理它。它适用于所有浏览器。唯一的问题是我在 IE8 中收到安全警告。

问题 1:有什么方法可以安全地获取 JSON 数据并在 IE 不抛出任何警告消息的情况下处理数据?

问题 2:我如何以及在哪里设置这个:Access-Control-Allow-Origin: http://youtube.com,这样 IE 就不会抛出任何警告信息?

4

1 回答 1

0

Try using

https://gdata.youtube.com/feeds/api/videos/ID?v=2&alt=jsonc

Since you are in https, IE wants all resources accessible within that domain to be secured. I feel previously you were using http:// in the request URL of youtube. Change it https, it may solve the security warning issue.

If a secure page loads any nonsecure resource, its going to throw the warning. The only way to get around it is to load everything from https.

Here you are trying to load a non secured resource (http://gdata.youtube....) in the secured website.

HTH

于 2012-07-30T07:10:46.743 回答