chacham15
chacham15

Reputation: 14251

How do I implement a Gchat like popup?

I had Gmail open in a browser that was minimized and when someone sent me a message via gchat, i got a popup notification in the corner of the screen. The popup had no top bar (the one with the minimize, full screen, and close in the top right corner) and the close was integrated into the window in its own design. Is there a way to create a window (i.e. popup) without a top bar (in addition to without the browser bars)? Thanks!

Upvotes: 1

Views: 650

Answers (2)

josh3736
josh3736

Reputation: 145002

You want to use the Web Notifications API.

Note, however, that the API is not (yet) standard and is currently only supported by Chrome. (Although there are Firefox extensions that can be installed to enable the functionality.)

Upvotes: 3

diracdeltafunk
diracdeltafunk

Reputation: 1194

This is relatively simple, all you have to do is create an element with javascript.

Here is some sample code:

function makeBox() {
   box=document.createElement("div");
   div.innerHTML="HTML to go in the popup window.";
   div.id="popup";
   document.body.appendChild(box);
}

of course, you put an a tag like this:

<a href="javascript:document.body.removeChild(document.getElementById('popup'));">X</a>

in the HTML of the popup to add the close feature. This is a simple example, you can add CSS styling and other features easily.

Upvotes: 2

Related Questions