开发者

Open a webpage in the background, show the page has finished loading

开发者 https://www.devze.com 2023-03-19 08:37 出处:网络
How to run a php script in the background on the server w开发者_运维问答hen a user opens a webpage?

How to run a php script in the background on the server w开发者_运维问答hen a user opens a webpage?

Important: The user does not note when the script finishes and DOES NOT NEED THE OUTPUT.

So the user nudges the script indirectly by visiting the webpage and that is all about it.


The only way would be to:

  1. Output the wrapper page.
  2. The wrapper page contains a javascript snippet which sends a AJAX request to the server.
  3. The server loads the page you want to show the user, the server returns the contents of the page.
  4. The javascript snippet displays the content.


Not sure I fully understand the question but you can make an AJAX call once the page is loaded, that calls the PHP backend that could load the page or do whatever it needs to do and return whatever data it needs to return back to the browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号