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 6208549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:49:40+00:00 2026-05-24T05:49:40+00:00

I want to create a javascript which checks if a new rss feed has

  • 0

I want to create a javascript which checks if a new rss feed has been
updated and display a notification using phonegaps notification
methods. http://docs.phonegap.com/phonegap_notification_notification.md.html#Notification

     var oldEntry="";
 document.addEventListener("deviceready", onDeviceReady, false);

    // PhoneGap is ready
    //
    function onDeviceReady() {
        // Empty
    }

    // Show a custom alert
    //

    function sendRequest(){

      getRss("http://rss.cnn.com/rss/cnn_latest.rss.xml");      
      setTimeout('showAlert(newEntry.title)',4000);

    }


    function showAlert(data) {
     var st = randomString();
     if(oldEntry==""){
        oldEntry = data;
        navigator.notification.alert(
                data,  // message
                'New Rss Entry',            // title
                'New Rss Entry'              


        );        
     }

     else {
       if(oldEntry!=data){
        navigator.notification.alert(
                data,  // message
                'New Rss Entry',            // title
                'New Rss Entry'              


        );
        oldEntry = data;

       }
       }

       setTimeout('sendRequest()',8000);
    }

    function randomString() {
        var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
        var string_length = 8;
        var randomstring = '';
        for (var i=0; i<string_length; i++) {
            var rnum = Math.floor(Math.random() * chars.length);
            randomstring += chars.substring(rnum,rnum+1);
        }
        return randomstring;
    }

   sendRequest();

Right now both new along with the old Rss title pops up as notification, is it possible to restrict the function to display only the latest Rss title ?

And even after I dismiss both the notification after 8000 ms they both appear again, but I want to check if there are any new notifications and display only them, not the one s the user has dismissed.

This is for getting the newentry.

    var newEntry="";
        function getRss(url){
        if(url == null) return false;

                    // Create Google Feed API address
                    var api = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="
    + encodeURIComponent(url);

                    api += "&output=json_xml"

                    // Send request
                    $.getJSON(api, function(data){

                        // Check for error
                        if (data.responseStatus == 200) {

                            // Process the feeds
                            _process(data.responseData);

                        } 
                                  else {

                        };
                    });             

        }

        var _process = function(data) {

                // Get JSON feed data
                var feeds = data.feed;
                if (!feeds) {
                    return false;
                }

// Get XML data for media (parseXML not used as requires 1.5+)
                var xml = getXMLDocument(data.xmlString);
                var xmlEntries = xml.getElementsByTagName('item');
                var entry = feeds.entries[0];
                newEntry = entry;

            };
  • 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-05-24T05:49:41+00:00Added an answer on May 24, 2026 at 5:49 am

    there could be many problems. I think maybe you are hitting a caching error. so try adding this –

    api += “&tempVar=” + Math.random()

    right after your code –

    api += “&output=json_xml”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am want to create a javascript function using jQuery which will close the
I want create a pdf using iText. The method which does this is a
I want to create a Firefox extension using c++ XPCOM component which in turn
I want to create a javascript/jquery function which will resize an img (while maintaining
Let's suppose I want to create a javascript class/object/function which have a method that
I want to create a javascript form that basically has a bunch of text
I want to create a compiled JavaScript file for my website. For development I
I want to create a string in JavaScript that contains all ascii characters. How
I want to create a draggable and resizable window in JavaScript for cross browser
Basically I want to create one large object of many object in JavaScript. Something

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.