I just made a phonegap application that parses an external RSS feed using jFeed. I will give you an example:
First, I include the following Java scripts in the index.html file:
<head> ... <script type="text/javascript" src="phonegap-1.0.0.js"></script> <script type="text/javascript" src="jquery/jquery-1.6.4.js"></script> <script type="text/javascript" src="jquery.mobile/jquery.mobile-1.0b3.min.js"></script> <script type="text/javascript" src="jquery.jfeed/dist/jquery.jfeed.js"></script> <script type="text/javascript" src="scripts/my.js"></script> ... </head>
Then in my.js I use the following:
parseFeed(); function parseFeed() { $.getFeed({ url: 'http://someUrl.com', dataType: "xml", success: function(feed) { $('#feedresult').empty(); var html = '<ul data-role="listview">'; for(var i = 0; i < feed.items.length; i++) { var item = feed.items[i]; html += '<li>' + '<a href="#article?id=' + i + '">' + item.title + '</a>' + '</li>'; } html = html + '</ul>'; $('#feedresult').append(html); $('#main').page('destroy').page(); }}); };
The code then creates a list (jQuery mobile) in my #feedresult div, where each entry represents a feed item. Since the telephone delay uses some kind of web browsing, which downloads all the content using the file: /// protocol ( http://groups.google.com/group/phonegap/browse_thread/thread/b60bda03bac6e9eb ), in cross domain execution XMLHttpRequest from the phone saver.
Lasse Christiansen Sep 25 '11 at 20:26 2011-09-25 20:26
source share