About the HTML iframe

Asked

Viewed 27 times

-1

Hello guys? So it’s a simple question I want to know about iframe in html, I was wondering if iframe stores the sites in cache?

Reason: my site is static and I want to use iframe to leave a little dynamic.

  • 1

    The cache control is not done by the "tags" as IFRAME is done by what the reply HTTP specify and by what the user’s browser decides to keep

1 answer

2

The cache control is not done by the "tags" as IFRAME and is not solved on the front end, it is done by what the reply HTTP specify and by what the user’s browser decides to maintain, will not differentiate access via IFRAME or direct, unless detecting the HTTP header Sec-Fetch-Dest: iframe that sends the instruction, and this will only be useful if the site that receives the HTTP request is dynamic and understands that when receiving something like:

GET /iframe.html HTTP/2
Host: foo.bar
Connection: keep-alive
Referer: https://foo.bar/
Sec-Fetch-Dest: iframe
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin

This above is what your browser sends to the site to request the page within IFRAME, so if the server has implemented something to detect the Sec-Fetch-Dest: iframe and say in that case that you should not cache or do.

Now understand that this will only work if you program on the server side, but the "normal" (in case of static pages) is do or not cache a page based only on headers returned by the back end and that have nothing to do with IFRAME.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.