Need Popup window as soon as an update happens

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • subashini Thiyagarajan
    New Member
    • Dec 2006
    • 218

    Need Popup window as soon as an update happens

    Hi,

    Any one can help me in this.

    I need a popup even my application minimized in the status bar.whenever any update happens suddnely one popup window should appear in the desktop with the last record informations

    Any help,.......... ..........
  • elmemo
    New Member
    • Apr 2007
    • 30

    #2
    although there are better ways out there, they depend on you having control of the app and I'm guessing you haven't. A simple trick you could use is instruct the browser to reload the contents every 30 seconds, and then have a javascript function that parsed the input and in case it's got new info you can maximise the window, send an alert message, etc...

    If you don't have access to the application code, to instruct the browser to reload the contents you can write a simple webpage that inside has a frame to the actual webpage you want. this way you can reload the content with a meta tag in the header of the container page, or with a javascript funciton. Of course your script will need to look into the inner frame's code to parse out info.

    Is this more or less what you are looking for?

    Comment

    • subashini Thiyagarajan
      New Member
      • Dec 2006
      • 218

      #3
      Hi Elmemo,

      Thanks for your explanation.

      I do agree what you are saying. We can use Meta tag to make the page refreshed with latest information with a defined interval.

      But, I need the page to be refreshed one and only any update happens newly.

      Is it possible? So that when the page gets refreshed we can give default pop up window to display last record.


      How to make the meta refresh with the update condition?

      Any help

      Thanks
      subashini

      Comment

      • elmemo
        New Member
        • Apr 2007
        • 30

        #4
        Subashini,

        the "meta refresh" tag, the way browsers implement it today, is non-conditional. (I don't know of any way you can refresh only on update with a meta-tag).

        However not all is lost. you can have a javascript function called when the body of a document you create loads, that would look into an inner frame containing the site that updates continuously, and parse for some indication that would tell you the information has been updated (for example, maybe the page you are looking at does have an update timestamp somewhere that you can use). The limitation with Javascript here is that it can only read into frames that come from the same site the javascript document is executing.

        If you need something more powerful, or the site you want to analyse is on a server not in your control, consider installing cygwin in your pc (I'm assuming you are running windows), install curl on cygwin, and then using a bash/python/tcl script, that relies on "curl" to get the site information, and then you can parse the site contents in whatever shell you chose. This way you could launch notepad or even dynamically build a webpage with the most recent changes extracted and have a browser read it.

        Also if you know .NET you can try to do the same with a webclient on powershell.

        In case you are able to opt for the javascript approach, I include some sample code here that I tested. It reloads the frame every 5 seconds and looks inside the frame document for some changed date information. You would have to adapt it. Remember this only works if the iframe is on the same server as the following document:

        Code:
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" >
        <head>
            <title>Page sans titre</title>
            <script type="text/javascript">
              var lastUpdate = new date();
              alert(lastUpdate);
              function lookForUpdate() {
                frames['fr'].location.reload();
                var currentDateAsString = (frames['fr'].document.getElementById('dateElement').innerHTML); //we assume that the frame is in the same server, also we assume there is a way to get to the date element (here we are really optimistic about it having an ID)
                //var currentDate = [somehow parse the date string] currentDateAsString
                if (currentDate > lastUpdate) {
                   lastUpdate = currentDate;
                   alert ("update!"); //instead of alert, you can send a popup, or whatever
                }
              }
            </script>
        </head>
        <body onload="setInterval('lookForUpdate();',5000);">
            <iframe src="index.html" id="fr" name="fr" ></iframe>
        </body>
        </html>

        Comment

        • subashini Thiyagarajan
          New Member
          • Dec 2006
          • 218

          #5
          Hi Elmemo,

          Thank you so much for your mail.I am sorry to say that i did not get what u are trying to say.Please explain me in detail.

          i wanted to do in ASP and ACCESS

          thanks

          Comment

          • elmemo
            New Member
            • Apr 2007
            • 30

            #6
            Hi,

            ooooh ok so it's YOU who is going to write the webpage. That makes things easier. If you are using ASP, you could send a last-upgrade timestamp with your document somewhere. This timestamp would have an html "id" (if you are not using master pages, you can count on the html rendered document "id" property being the same as the asp.net "id" property in the aspx code), so this way you will be able to easily access this via a javascript script.

            the idea would be to have a second webpage, which would be just a wrapper for the first one (this is, it will have a frame with the "src" attribute pointing to the webpage you want to monitor). In this second webpage you could have a javascript function that periodically looks into the frame and checks the value of the timestamp (by way of the "id" property you gave it). This way, if the timestamp is newer than the previous one you know your document has been updated, and then you can take appropriate action, for example maximising the window or something.

            In my previous post, that is what the example code does. It contains a frame that contains a webpage, and periodically looks for the element called "dateElemen t" of the inside frame. This is the element that you would create in your asp.net code that would contain your update-timestamp.

            Comment

            • subashini Thiyagarajan
              New Member
              • Dec 2006
              • 218

              #7
              Thanks,but don't give comparision with ASP.net

              i don't know .net.so,i can not follow what you are saying.

              Give me some easiest way with code na..pls

              thanks,sorry for this mail

              Comment

              Working...