How to make iframe not saved in history in Chrome?

I am trying to develop a Chrome extension that embeds an Angular application in a user's browser window to make an interactive sidebar. I basically was able to achieve 100% of what I want by adding an iframe to the page through the content script and setting the frame source to an html file inside my extensions directory.

Unfortunately, since the Angular application has several routes (allowing the user to log in and see many different types of information), I found that it was preventing the user from using his back / forward buttons as expected; since the iframe source changes due to hashes, it saves a new entry in the history.

I cannot find or create a workaround for this; Is there any clever way to make either Angular not generate historical records, or create a sidebar that doesn't save in history without using an iframe, or disable an iframe to save to history?

+4
source share
1 answer

Ultimately, I tried to write a chrome extension that implements an angular application inside an iframe, but found that all the hash changes interfered with the Chrome history because the iframe source was constantly changing due to routing changes.

, ui-router angular, (, ui-router URL-, ), , iframe iframe : window.location. .

, , iframe Chrome:

  • src iframe '#'
  • iframe
  • iframe frame location.replace :
    • $("#myIframe").get(0).contentWindow.location.replace(myUrl);
  • iframe URL- location.replace(url)
  • angular : $location.path(newPath).replace(), angular .

, $location.replace() , . , : location.replace iframe .

+6

Source: https://habr.com/ru/post/1545982/


All Articles