Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7773315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:06:25+00:00 2026-06-01T17:06:25+00:00

I am trying to display an RSS feed in HTML. It works on iPad,

  • 0

I am trying to display an RSS feed in HTML. It works on iPad, iPhone and chrome but not in internet explorer or safari. I get an error message saying

x[i].getElementsByTagName("image")[1] is undefined 

Does anyone know how I can get this to work? It is using an Apple RSS feed to display apps from the App Store. The error is occurring at the first document.write. I am trying to display the returned results in a table also.

        <html>
<head>
<title>RSS Apps</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script type="text/javascript">
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.open("GET","http://itunes.apple.com/au/rss/topfreeapplications/limit=10/xml?partnerId=1002&partnerUrl=http%3A%2F%2Fwww.s2d6.com%2Fx%2F%3Fx%3Dc%26z%3Ds%26v%3D3868801%26t%3D",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML; 

var x=xmlDoc.getElementsByTagName("feed");
for (i=0;i<x.length;i++)

  { 
  document.write("<a href="+x[i].getElementsByTagName("id")[1].childNodes[0].nodeValue+"><img src=" + x[i].getElementsByTagName("im:image")[1].childNodes[0].nodeValue +"></a>");
  document.write("</td><td>");
  document.write("<a href="+x[i].getElementsByTagName("id")[2].childNodes[0].nodeValue+"><img src=" + x[i].getElementsByTagName("im:image")[4].childNodes[0].nodeValue +"></a>");
  document.write("</td><td>"); 
  document.write("<a href="+x[i].getElementsByTagName("id")[3].childNodes[0].nodeValue+"><img src=" + x[i].getElementsByTagName("im:image")[7].childNodes[0].nodeValue +"></a>");
  document.write("</td></tr><tr><td>");

  document.write("<font size=\"1\"><a href="+x[i].getElementsByTagName("id")[1].childNodes[0].nodeValue+">" + x[i].getElementsByTagName("name")[1].childNodes[0].nodeValue+"</a>");
  document.write("</td><td>");
  document.write("<font size=\"1\"><a href="+x[i].getElementsByTagName("id")[1].childNodes[0].nodeValue+">" + x[i].getElementsByTagName("name")[2].childNodes[0].nodeValue+"</a>");
  document.write("</td><td>");
  document.write("<font size=\"1\"><a href="+x[i].getElementsByTagName("id")[1].childNodes[0].nodeValue+">" + x[i].getElementsByTagName("name")[3].childNodes[0].nodeValue+"</a>");
  }
</script>
</td></tr>
</table>
</div>
</body>
</html>

Updated code to handle “im:image” and the code now works in internet explorer and safari but not in chrome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:06:27+00:00Added an answer on June 1, 2026 at 5:06 pm

    This will give a result. DEMO

    Notice I access the entry elements and in the entries I access the im:image tags

    UPDATE This works in IE8, Fx Safari and Chrome on XP

    <html>
    <head>
    <title>RSS Apps</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <script type="text/javascript">
    var isIE = navigator.userAgent.indexOf('MSIE')!=-1;
    var ns = {im:"http://itunes.apple.com/rss"}; // could be extracted from the root element's attributes
    
    function getElems(obj,tagName) {
      if (!obj.getElementsByTagNameNS) return obj.getElementsByTagName(tagName);
    
      var prefix = "";
      if (tagName.indexOf(":") !=-1) {
        var parts = tagName.split(":")
        prefix = parts[0];
        tagName = parts[1];    
      }
    
      if (prefix == "") return obj.getElementsByTagName(tagName); 
    
      return obj.getElementsByTagNameNS(ns[prefix], tagName);
    }
    window.onload=function() {
      var xmlhttp;
      if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
      }
      else   {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.open("GET","http://itunes.apple.com/au/rss/topfreeapplications/limit=10/xml?partnerId=1002&partnerUrl=http%3A%2F%2Fwww.s2d6.com%2Fx%2F%3Fx%3Dc%26z%3Ds%26v%3D3868801%26t%3D",false);
      xmlhttp.send();
      xmlDoc=xmlhttp.responseXML; 
      var x=xmlDoc.getElementsByTagName("entry");
      var html = "";
      for (var i=0;i<x.length;i++) {
        var entry = x[i];
        var id =getElems(entry,"id")[0].textContent;
        var nameTag = getElems(entry,"im:name");
        var name = isIE?nameTag[0].text:nameTag[0].textContent;
        html += '<a href="'+id+'">'+name+'<br/>';
        var images = getElems(entry,'im:image');
        for (var j=0;j<images.length;j++) {
          html += '<img src="'+(isIE?images[j].text:images[j].textContent)+'"/>';
        }
        html+='</a><hr/>';
      }
      document.getElementById('content').innerHTML=html;
    }  
    </script>
    
    </head>
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div id="content"></div>
    </div>
    </body>
    </html>
    

    UPDATE 2

    jQuery version DEMO

    $(document).ready(function() {
      jQuery.support.cors = true; // IMPERATIVE for IE(8) support
      $.ajax({
        type: "GET",
        url: "http://itunes.apple.com/au/rss/topfreeapplications/limit=10/xml?partnerId=1002&partnerUrl=http%3A%2F%2Fwww.s2d6.com%2Fx%2F%3Fx%3Dc%26z%3Ds%26v%3D3868801%26t%3D",
        dataType: "xml",
        success: function(xml) {
          $(xml).find('entry').each(function(){
            var id = $(this).find("id").text();
            var title = $(this).find("title").text();
            $("#content").append('<hr/>'+title+'<br/>'); 
            var images = $(this).find("image");
            if (images.length ==0) images = $(this).find("im\\:image");
            $.each(images,function(){
              $("#content").append('<a href="'+id+'"><img src="'+$(this).text()+'"/></a>');
            });
          });
        }
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to display a RSS feed in a PHP page, but
I am using a RSS feed to display content in my app. Everything works
I'm trying to load the parsed html data from an rss feed using a
I am trying with the code below to get a bing rss news feed,
I'm trying to open/display the rssfeed http://www.golfweekly.nl/rss.php in a uiwebview. But the screen stays
I have a blog's RSS feed that I am trying to display on another
I am trying to customize date from my RSS feed to display like how
I'm trying to display a custom progressdialog while loading RSS feed from an HTTP
I'm trying to display rss feed using jQuery plugin jFeed as below. It's printing
I am trying to read two Rss feed urls at regular intervals and display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.