I'm trying to develop a Chrome extension that is supposed to completely replace a specific website's pages with a new UI. In other words, when the user visits said website, the extension should "intercept" it seamlessly and display the new "app" (preserving the URL and without opening a new tab or window). I currently use a content script to manipulate the DOM, but it's too messy.
Chrome apps such as Google Docs achieve the same goal through URL handlers, but they're not an option since they're now deprecated.
Currently, I'm aware of two options:
- Intercept the URL and redirect it to an extension URL. I want the URL to be preserved.
- Use a content script to stop the page from loading at
document_start(usingwindow.stop()) and then "inject" the new app. Apparently, that works, but it sounds quite hacky and prone to unexpected glitches.
What I'd like to know:
- Is the second approach good enough? What limitations and other issues will I face if I use it?
- Is there any other approach that is at least as good (and preferably designed for this purpose)?