-3

I have Button if I click on it shows message to everyone who online on my web site

ali nagi
  • 1
  • 1

1 Answers1

0

If you want user to just get informed you can use alert method from window object https://www.w3schools.com/jsref/met_win_alert.asp

e.g

alert("Save Document!");

or if you want to give user option during alert like "save" or "cancel" you can use confirm https://www.w3schools.com/jsref/met_win_confirm.asp

var bol = confirm("Save Document");
if (bol) {
     doSaveThenRemoveToSystem();
} else { //doNothing
}

UPDATE:

if you want a global alert message to all login users that will be sent before you upload your bin files, then that will require more than an alert or confirm implementation.

What you need is to implement Observable Pattern wherein login users will listen to the provider/source changes. so if you are about to upload anything the program first will update the users by updating the source object they are listening.

Depending on the technology you are using with your webapp whether you are using jsf or not, I assume you are just using plain javascript/html tech you can just send a request to the server from user session/browser to get the latest state of the object they are listening. (given this object is a singleton bean created upon spring initialization), if the values are changed then you trigger alert messages to users within a span of time.

Since the question it self is not that intuitive please excuse me if I am getting the wrong idea.

mark ortiz
  • 659
  • 1
  • 6
  • 13