Most Windows programs have desktop reminder (POPUP) features such as MSN Messenger, Outlook2003, Foxmail, Sharpreader, etc., which can be very convenient for users.
A similar feature can also be achieved in the web, and a similar feature has been added in CNForums1.2, just like Outlook2003, when there is a new post / private message, there is a popup prompt, as shown : Now introduce the technical problem:
First, what is POPUP
There are a lot of special features in the POPUP window that is supported in IE5.5 :
The popup window can exceed the browser window area; you don't have to worry about it is blocked by the drop box, flash, iframe and other things; the instant window does not focus, the Popup window can also pop up and display a popup window to open, or click on its area or Another POPUP window is turned off when it is opened; the Popup window is not focus; the user cannot change the size of the POPUP window; the content in the popup window cannot be selected; ......
Just the WEB's popup is still enough than the popup in Windows, but it is already enough. MSDN has a very detailed introduction to POPUP "Using the popup object (Internet Explorer - DHTML"
Second, 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.document.body;
//
Insert HTML in Body
Opopupbody.innerhtml
=
"
Display Some html b> here.
"
;
//
Set the location, size, reference
OPOPUP.SHOW
100
,
100
,
200
,
50
, Document.Body;
Third, POPUP display
Multiple popups cannot coexist (except for popup), except for popups in POPUP, so the popup in the web is not convenient to "climb the stairs" like the MSN Messenger's Popup, so the simplest and effective way is the same as the Outlook2003 Popup, a Popup reminder. (Refer to WebMessenger's implementation) Use JS to build a queue, which will require Popup prompts in the queue, use a timer, take a POPUP from the queue, each POPUP shows for 7 seconds.
Fourth, how do you know a new post?
In a web program, only the technology of "pull", the request is sent to the server - through the timing refresh or the XMLHTTP GET. We need a timestamp to record the last request time, so it is good to obtain the post after this timestamp. If you get the latest post according to time stamp, the server load is relatively large, because it is not a new post every time, optimize it, then give each online user have no new post, there is a new message state bit When published a new post, update each person's "no new post" status bit. This makes each request, and if there is any new post, if there is a new post, get the title and content of all posts.
V. Specific implementation
Client code: http:/Webuc.neet/myproject/popup/popup.htmhttp: //webuc.net/myproject/popup/popup.rar and forum program combination: demo: http://bbs.openlab.net .cn (there is a new post after logging in (IE5.5 )) http://bbs.openlab.net.cn/postattachment.aspx?postid=376725