After the back-end modifies the configuration file, the front-end refreshes the page -- with authentication

  background:

  For a PC-side website, after a user logs in, the content displayed on the website will vary according to the configuration set by the user in the website. That is to say, each user has enabled and configured different configuration items on the configuration page. , then when you visit the homepage of the website for the first time, the displayed content will also be displayed or hidden according to the configuration.

 

  question:

  Because it is a PC terminal, you can open multiple tabs at the same time, and you can also open a mobile terminal, but this is rarely the case.

  The HTTP protocol used by this website, not using WebSocket.

  When you visit the website for the first time, the three operations A, B, and C that can be performed are displayed, and the tab page at this time is one.

  Then open a new tab two, and visit the website again. At this time, the content of tabs one and two should be the same. If they are not the same, there should be a problem.

  Then enter the configuration interface in two, target is _blank, operate in the configuration page, close operation A, and after saving, when the user visits the home page of the website again, operation A should be hidden.

  At this point, go back to the tabs one and two, and you will see that the A operation is still displayed, right, this is normal, because there is no refresh.

  Because the http protocol is used, the server cannot actively push information to the client, so if the client does not refresh, the content of the client will never be refreshed.

  Maybe you will say to use ajax timed requests, this can also be achieved,

  But there is such a problem:

  1. If the user's current web page is browsing some content, the regular ajax query shows that the configuration has changed, and then the web page is refreshed, then the user's current browsing content will be searched again, and then browsed, such a user experience is very bad. Okay.

  2. Ajax timing request depends on the situation, if the user's operation is frequent

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324937104&siteId=291194637