Jump to content

Single popup window


tekton

Recommended Posts

Hello , everyone. Was wondering if you can put a single popup that could appear to many visitors to a site at the same time , regardless of the page you 're browsing . Is there a chance to do it in JavaScript or another language ? Hwo could i do it? Iappreciate the help .

Link to comment
Share on other sites

That's why I asked about the trigger.

 

dsonesuk, what if the trigger is situational (not time sensitive)?

 

Let's say a bad storm is heading towards us and 50 users are deciding what to buy on various pages of a site (pages that have already loaded).

 

I can't imagine how to force a pop up after the page is loaded (with code that wasn't in the page when it loaded).

 

Is that possible? If so, how generally?

Edited by niche
Link to comment
Share on other sites

Ha ha, So bad storm heading toward you, and with phone, TV, etc warning you about the storm also neighbours running around frantically outside, you! rather than find place of safety, or secure your property, are more interested in buying stuff so you will look good in the storm, this would be a evolution scenario, where the idiots die, and people with common sense would survive :-) .

Link to comment
Share on other sites

It was just an example.

 

So, it seems you're limited to the code that that's loaded.

Link to comment
Share on other sites

Basically, it sounds to me you want to implement the same technologies used in Chat rooms.

 

When people connect to a web page with an imbedded Chat plugin, it "subscribes" with server so that the server knows who is currently online at the time. eventually the subscription will expire on its own, disconnecting the user, unless the plug-in renews the subscription with the server (which they do automatically as long as the program remains open). In a chat room when someone inputs text, the text is transferred to the server and the server then announces the text to all other users currently subscribed to the server. Those that left the page have technically unsubscribed so the server won't send any data to them.

 

What you want is something similar, but without the user input. What you want is for when users view a page they automatically subscribe to the server for a minute or so, renewing the subscription every minute they remain on the site. and when you type out a file to send, the server then publishes the file and sends it to everyone currently registered. You then have javascript or whatever plugin your running to capture the announcement and process it so that it can be displayed. This Observer pattern should pose the least overhead to the system, each user simply sends notification that they are still there, not requesting any data. and when some news does arrive the server knows exactly who is able to see it.

 

 

another method is to use an RSS feed which requires the user to reload the page. Otherwise it fully meets the criteria you want.

 

yet another option is to have an invisible iframe that periodically (once per minute is likely ideal) requests the news feed. by abusing the last-modified attribute and sessionstorage, each user will know if they have seen the news before. If so, then last-modified ensures the server isn't wasting bytes on sending them old news while client side the onload event is suppressed since last-modified matches what is in the session storage. If the info IS new to them, the server sends the new page to them, session storage updates to the current last-modified date, and the page's onload event runs creates a popup. Just like the RSS choice the update isn't instant as each client has to proactively request the news themselves, and since each client is not aware of each other they won't have synchronized updates.

Edited by Hadien
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...