PSWriteHTML icon indicating copy to clipboard operation
PSWriteHTML copied to clipboard

AutoRefresh in IE reverts to first tab

Open DyoGTS opened this issue 6 years ago • 6 comments

When creating a dashboard using the -AutoRefresh option, Internet Explorer always reverts back to the first tab, while Chrome will stay on whichever tab you're already looking at.

This may be a limitation of IE, but it would be great if we can get it to match the behavior of Chrome.

DyoGTS avatar Nov 14 '19 18:11 DyoGTS

This is because IE doesn't support Local Storage for Local files (only hosted ones should work). Local Storage is used to keep tabs open the way they are.

There is a workaround for that: https://stackoverflow.com/questions/3392032/localstorage-object-is-undefined-in-ie but that's a hacky hack and requires zone changes.

PrzemyslawKlys avatar Nov 14 '19 19:11 PrzemyslawKlys

I should clarify that in my instance the file is being housed on our Sharepoint server, and site is in the Trusted sites zone. Would this still be the case?

DyoGTS avatar Nov 14 '19 19:11 DyoGTS

Open up IE console

image

And wait for things to happen. See if the message shows up. I'm doing try/catch.

As far as I understand this should work on Hosted IE.

You can try this and verify that local storage indeed works:

https://stackoverflow.com/questions/9539877/viewing-local-storage-contents-on-ie

PrzemyslawKlys avatar Nov 14 '19 19:11 PrzemyslawKlys

Yep, I can confirm that this is the same error on our hosted Sharepoint server.

image

image

DyoGTS avatar Nov 14 '19 20:11 DyoGTS

This is related to this code:

https://github.com/EvotecIT/PSWriteHTML/blob/7e6f374d8853370dce10833505c6e5009c98978f/Resources/JS/tabbis.js#L59-L63

And this:

https://github.com/EvotecIT/PSWriteHTML/blob/7e6f374d8853370dce10833505c6e5009c98978f/Resources/JS/tabbis.js#L86-L95

Not sure if we can fix this. I don't know that much about JS.

One needs to see what E holds when it crashes, Maybe it's Object.Values or JSONParse problem and there's an alternative in IE. Whether it crashes on SetItem or getItem.

PrzemyslawKlys avatar Nov 14 '19 22:11 PrzemyslawKlys

Potentially to test if

<!DOCTYPE html>
<script>
  localStorage.setItem('test', '12345');
  alert(localStorage.getItem('test'));
  localStorage.clear();
</script>

Works as hosted page.

PrzemyslawKlys avatar Nov 14 '19 23:11 PrzemyslawKlys