0

I have a webpage which has an iframe. The iframe source is a different website.

  • The initial content of iframe is to display Sign-In, on click of which it opens a new tab for authentication.
  • Once authentication is complete, the browser automatically closes this new tab and refreshes the iframe in the previous tab to load the data.

This is done using window's storage event handler. On successfull sign in, a specific storage key is updated in the sign in page, which triggers the event inside the iframe, and the iframe is then reloaded.

The inital content of iframe has a window storage event handler something like this

window.addEventListener('storage', storageEventHandler, false);

function storageEventHandler(evt) {
            switch(evt.key) {
                case 'accessTokenRefresh': location.reload();
            }
        }

This works perfectly fine in Chrome and Firefox without any issues.

Problem in IE 11 - After successful sign in, the location.reload(); inside storageEvenHandler makes the browser redirect to the URL instead of just reloading the iframe.

Notes - I have tried using sandbox attribute and it's different values and their combinations, but no luck there.

Thanks a lot for reading this till here. Any help would be appreciated

Ravi Sankar Rao
  • 1,050
  • 11
  • 26

1 Answers1

0

Try using

document.getElementById("Frame_ID").contentWindow.location.reload();

Found here (StackOverflow)

Rojo
  • 2,749
  • 1
  • 13
  • 34