trigger-corp / browser-extensions

Build and run cross-platform browser extensions from one codebase.
Other
312 stars 52 forks source link

Add Detection for IE Page Refresh Events #62

Closed reicolina closed 5 years ago

reicolina commented 5 years ago

Fix for issue https://github.com/trigger-corp/browser-extensions/issues/51

This patch is a simplified version of the solution suggested in https://www.codeproject.com/Articles/3632/Detecting-the-IE-Refresh-button-using-IWebBrowser2 and also took some ideas from a fork done by the folks at Grammarly (https://github.com/grammarly/browser-extensions)

The issue is caused by the fact that IE does not trigger neither BeforeNavigate2 or DocumentComplete events, so the suggested solution relies on DownloadBegin and DownloadEnd, setting flags on and off depending on the situation and events.

Tested in IE11 against the IE demo plugin in https://github.com/rei-colina-experiments/ie-browser-extension-demo and it works like a charm there! Supporting multiple tabs and multiple IE window instances.

antoinevg commented 5 years ago

Thank you!