php - Weird behavior when using custom HTTP header -
My website uses AJAX to load pages in a div
and each AJAX The following custom header sends the request: X-AJAXRequest
.
If the header is present then my website sends the body without the header and footer, otherwise it sends the whole page
This is my PHP code:
if (empty ($ _ server ['HTTP_X_AJAXREQUEST'])) {echo ($ head); Echo ($ body); Echo ($ script); } And (Include ("master.php");}
Now, the problem is, when someone visits X, clicks on the Y link, then X on X Clicks on the X header and footer, such as the headers do not exist, even when Developer Tools (F12) is open!
I think it can be caching, because IE11 (I am developing the browser), but still, why caching is mine
It seems that this is actually caching, which is causing you problems. Once the user has visited X, your browser caches (depending on which caching rules are there and the server has been provided). When you go to Wi and try to load X through AJAX, browser knows The cache already has X and saves it from there (never sending a request to your server).
By default, when you install Developer Tools (F12) If you open, then caching is stopped, this is the reason why you see this problem when you have it. You can go to the Developer Tool Settings (top right corner) and uncheck "disable disables" (while DevTools are open). Then you should be able to bring browser X from cache to page wi.
An easy way to resolve this is that URLs (eg, some examples like "ajax = true") call AJAX calls), in this way the browser will treat X and X? AJAX = Really two different "resources" and two different versions of the cache.
Comments
Post a Comment