Is there a way that an action initiated by a user, on a client Browser( like clicking a button), can change characteristics of the page loaded by other clients.
The reason I need this is for controlling a device that post information onto a page and waits for a response to see if it can still continue posting information or not. I want that response to come from the user viewing the page. Both client browsers load the page from the server and they are not related in any way.
Thanks
Related
I am using javascript and Node JS to build a website to collect data for my writing research. The website is designed with a series of webpages with each page housing a different typing or writing task. Participants need to complete a task on one page, click the submit button to post the data to the server side, and click next to move on to the next page until they reach the last page of the study. For your information, here is the website I created: https://writingresearch.herokuapp.com.
However, here comes one issue: in some cases, when the internet connection on the client side is weak or unstable, it might take some time (say, more than 2 seconds) for the data to reach the server side for processing. In other words, the participant of the study may go to the next page before their posted data are successfully processed on the server side. If this happens, the server side ends up losing the data.
Thus, I am wondering if there is a method to enable the communication between the server side and the client side so that the user of the website cannot go to the next page until their post request is successfully processed. Does anyone know how to do this in Node JS? I hope I have explained my question clearly.
Thanks for your time and attention. I really appreciate your help!!!
On pressing the submit button, you should do the following:
Disable the "Submit" button so that user doesn't send another POST request again by clicking on submit button again. Show a loader somewhere so that user could know that answer is being submitted.
Disable the "Next" button until you receive a successful response from server.
On receiving successful response from server, enable both buttons and show a notification (such as an alert box) informing that the answer is submitted successfully.
If you receive error from server, then also show the error in the notification (or in the alert box) and enable both buttons.
I'm currently developing a website for a chat application (everything in the serverside is Django).
One of the problems I faced was how to keep the website (once a user is logged and has everything rendered) updated if the user needs to receive something new (a new message, notifications, etc).
The solution I came with was to first create a URL to send a get request, and the response would be a list of unseen notifications for the user. Then, in the HTML, a JavaScript code to send request to this URL and receive the unseen notifications.
This way, upon loading, the page will send a get and receive all unseen notifications and save them in a variable, after that it will keep sending the request every half a second and check if the rendered data is the most recent data, and if it's not, reload the page to refresh all the rendered data.
Now, this works ok, but I'm not sure this is how it should be done, as I'm bombarding with requests my server (currently, everything in development and just a couple of users at the time nothing exploded) and the client is sending request all the time. Is this how other webs (for example Facebook) keep themselves updated in case a new notification appears without the need of the user manually reloading the page?
Thanks in advance!
I would like to have a link or button on an HTML page that, when clicked, will redirect to an outside website page, after sending a GET or POST request to my web server. So rather than building a link URL that sends a request to my server which then in turn redirects to the outside website, I would like the redirect to happen at user-click time, where my server gets a simultaneous request specifying the click action, which I can then simply log on my server side.
On the server side, I don't need to actually respond to the GET/POST with anything useful, since I only want to log the request; i.e., I only want to make note of which user action was taken. I want the redirect to the outside URL to occur in the browser itself.
In essence, I am trying to do what Google or Fark do when they present the user with a list of website links, where clicking a given link first redirects to their site, which then redirects to the actual outside website. But I would like to do that without having to wait on my web server to do the redirect, since it only needs to be notified of which link the user chose.
I think I could do this with an AngularJS ng-click attribute that does an $http.get() or $http.post(), and just ignore the returned (pending promise) result, and then change the window.location to point to the outside website's address. But the browser will then load the new outside URL before the response from the pending GET/POST request is received, leaving me to wonder if this would have any bad side effects on the browser, receiving a spurious response to the GET/POST during or after the outside page load.
Is there a way for a web page to respond to a message from a web server, while idle? I need to display a page of user information. As a user swipes his card, a system will authenticate him, and then send a message to my solution, indicating that a user authenticated.
I then need to update a web page with his details. So, no interaction with the page from the user. It must just refresh when I send a message to it - somehow. Is this possible?
I was thinking of some sort of page which has 'subscribed' to events from a server, allowing me to send it, maybe a JSON object, and when it receives this message, refreshes the screen with the data from the messages it recieves?
We don't want to poll the server every second. We need to it respond to an incoming event. So, listening, as opposed to asking. and it has to be quick. So, the only delay would be the amount of time for the message to go from the web server, to the client browser.
We're using .Net application server, standard browser (Chrome, IE etc), a Bootstrap UI (Irrelevant, I guess).
I want to send a request (or any response or notification) from the server side to the browser without a browser request to the server.
I use JSP and the Struts framework in my Java EE application. When some one is on my page, and when some processing in done in my action class/servlets, I want to send a notification or message or request to the browser to be appeared on the page. Here the relevant page cannot be refreshed or reloaded and it may be handled on the browser side with javascript or jquery. I use Http.
Is there a way to do this?
EDIT: Example: The application is an online inventory system. An Admin has logged in. If one of the items is out of stock, the admin should be notified saying that that particular item is out of stock without the admin searching the stores and do nothing (when he is on his account page, a pop up may be displayed to him).
I am not so sure what you meant but according to my understanding you can do this.I guess Comet is the thing you are looking for.Comet is the technique where in server pushes the data to the browser.
Try Pushlet concept which might address your requirement
http://www.javaworld.com/jw-03-2000/jw-03-pushlet.html