开发者

Load google RSS feed in IE

开发者 https://www.devze.com 2023-01-20 13:14 出处:网络
I\'am writing a code using Google-Ajax-Feed-API to get feed from site. Here is my code for the same. <html xmlns=\"http://www.w3.org/1999/xhtml\">

I'am writing a code using Google-Ajax-Feed-API to get feed from site. Here is my code for the same.

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google AJAX Feed API - Simple Example</title>
        <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA5MxjlekOJilywavs2TkrKxR3jjpvUIxSLOdaAPuufKrvVh6s1RSHnixBY86Q-Ze6bbbVdDtzvnIORA"></script>
        <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
        <script type="text/javascript">

            google.load("feeds", "1");
            function initialize() {
                feed = new google.feeds.Feed("http://feeds.labnol.org/labnol");
                feed.load(function(result)
                {
                    if (!result.error)
                    {
                        var container = $("#feed");
                        for (var i = 0; i < result.feed.entries.length; i++)
                        {
                            var entry = result.feed.entries[i];
                            var header = $("<h2> <input type=\"checkbox\" name=\"rssItem\" /><span class=\"title\"> "+entry.title+" </span> </h2>");
                            var dataStr = $("<em class=\"date\">"+entry.publishedDate+"</em><p class=\"description\">"+entry.contentSnippet+"</p><a target=\"_blank\" href=\""+entry.link+"\">Read more...</a>");
                            var divObj = $("<div></div>");
                            header.appendTo(divObj);
                            dataStr.appendTo(divObj);
                            divObj.appendTo(container);
                        }
                    }
                });    
            }
            google.setOnLoadCallback(initialize);
    </script>
    </head>
    <body>
        <div id="feed"></div>   
    </开发者_运维知识库body>
</html>

This works perfectly in mozilla but not in IE. Can anybody tell me whats going wrong in IE?


Very strange problem, as soon as i changed

feed = new google.feeds.Feed("http://feeds.labnol.org/labnol");

to

var feed = new google.feeds.Feed("http://feeds.labnol.org/labnol");

everything starts working as expected in IE.

Thanks anyways.

0

精彩评论

暂无评论...
验证码 换一张
取 消