服务器可以强制浏览器等待而不更改网页代码吗?

I have a back end server that processes requests from several different websites. Meaning many websites ask my server for information that they present to their users browsers.

These websites have their own code and own server that I have no control over. I have to change my back end code which will now cause up to 5 minute delay in returning data to their server to be presented to their clients web browser.

Since I can't change the websites of all the clients, is there a way my back end server can force the clients browser to wait and not time out after they press submit on their browser?

Is there some thing I can return to the client server, that they can pass on to their clients browser so that it keeps waiting and doest give up when it doesn't get a reply from their website because I'm busy processing data?

Right now Im using php, but I can use any language that will solve the problem.

I'm desperate!

Thanks rough!

Most browsers will wait indefinitely (or at least, a really long time) for the server to respond to a request, provided a successful connection to the server was made, and the request makes it to the server.

I wouldn't recommend this route though. While browsers will wait, users likely won't. I suggest doing your work in the background, updating the status of the job in a database or something. Client-side, you can periodically poll for updates over AJAX, and then redirect the user as necessary when the job is done.

Your best method of action is to make sure the server isn't going to time out your php execution, make sure to set the execution time allowed for php scripts and all other applicable timeout settings for your http daemon along with php timeout settings.

As far as client timeout, there isn't much that can be done here, the client decides when they have had enough and to disconnect. A trick you could do, if you can, is to output something along the way to the final result, as long as output keeps coming through typically clients won't timeout. This could mean outputting periods until you have the final calculation ready.

If you really have no control over the client code, best you can do is try to make your side faster. Cache data if you can, precalculate results, etc

Fork off time-intensive processes into the background. Have them communicate their (partial) output data into a session store. Redirect the main page periodically to itself, reading content from the session store.

See Watching long processes through CGI for a complete program.