Web desktop reminder (popup)

Source: Internet
Author: User

This article is from Baoyu's blog
Http://blog.joycode.com/dotey/archive/2005/01/19/43277.aspx

Most Windows programs have the desktop reminder (popup) function, such as MSN Messenger, outlook2003, Foxmail, and sharpreader, which makes it very convenient for users to get the latest information.

Similar functions can also be implemented by using ie5.5 + popup on the Web. A feature added in cnforums1.2 is similar to outlook2003, a popup prompt appears when there are new posts or private messages,
Here are some technical questions:

I. What is popup?

The popup windows supported in ie5.5 + have many special features:

  • The popup window can be out of the browser window area;
  • You don't have to worry about being blocked by the drop-down box, Flash, IFRAME, and other things;
  • The instant window has no focus, and the pop-up window can also be displayed and displayed.
  • When a popup window is opened, it is automatically closed when you click outside its region or when another popup window is opened;
  • The popup window has no focus;
  • You cannot change the size of the popup window;
  • The content in the popup window cannot be selected;
  • ......

However, the web-based popup is weaker than the Windows-based popup, but it is enough. On msdn, I have a very detailed introduction to popup, "using the popup object (Internet Explorer-DHTML )"

2. How to Create a popup

Sample Code on msdn:
  // Create a popup object var opopup = Window. createpopup (); // The popup object is the same as the window object, which contains a complete HTML document var opopupbody = opopup.doc ument. body; // insert htmlopopupbody into the body. innerhtml = "display some <B> HTML </B> here. "; // set the position, size, and reference object opopup. show (100,100,200, 50, document. body );

3. Popup display

Multiple popups cannot coexist (except for creating popup in popup). Therefore, it is inconvenient for popup in the Web to "climb the stairs" as prompted by the popup in MSN Messenger ", so the simplest and most effective method is to notify popup one by one like outlook2003's Popup.
(Refer to the implementation of webmessenger) create a queue with JS, put all the content that requires popup prompts in the queue, and use a timer to regularly get a popup from the queue, each popup is displayed for 7 seconds.

4. How do I know there are new posts?

In web programs, you can only send requests to the server at regular intervals through the "pull" technology, that is, through timed refresh or XMLHTTP get.
We need a timestamp to record the last request time, so that we can obtain the post after the timestamp based on this timestamp.
If you obtain the latest post based on the time stamp each time, the server load is relatively high, because not every request has a new post, please optimize it, then, each online user is assigned a Status field with or without a new post or a new message. When a new post is published, the Status field "with or without a new post" is updated. In this way, you can determine whether a new post is available for each request. If a new post is available, you can obtain the title and content of all the posts briefly.

V. Implementation

Client code: http://webuc.net/MyProject/Popup/popup.htm
Http://webuc.net/MyProject/Popup/popup.rar

Integration with Forum programs:
Demo: http://bbs.openlab.net.cn (new post prompted after login (ie5.5 + ))
Http://bbs.openlab.net.cn/PostAttachment.aspx? Postid = 376725

Reference: XML + popup (ie5.5 +)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.