Prevent Iframe From Loading "src" Page Upon Refreshing June 27, 2023 Post a Comment I'm creating a static website and I am using iframes. The problem is, when I navigate to another page, say for example, this code for the iframe: Solution 1: You could store the current page location in a session, and on reload load the url stored in the session. But you'd need some server side technology. In just html you don't store things. You might also be able to use a GET value.Solution 2: You can't. By reloading the page you are loading a completely new page that just happens to come from the same resource as the previous page.You can't avoid reloading the iframe when you are reloading the main page, but you can make it reload the same page again.If you want to load a specific page in the iframe, you need to send information to the main page what to put in the iframe src. You can for example send that information in a query string, or put it in a cookie.Solution 3: If you have in your iframe the documents from the same domain (same origin), or you can set the Access-Control-Allow-Origin headers on displayed page, you can detect iframe src change, and save the current URL (cookie, localStorage or anything you have), and restore it on page load. Share Post a Comment for "Prevent Iframe From Loading "src" Page Upon Refreshing"
Post a Comment for "Prevent Iframe From Loading "src" Page Upon Refreshing"