Can a Chrome extension act as a web app instead of a website?

I am trying to develop a Chrome extension that is supposed to completely replace certain pages on a site with a new UI. In other words, when a user visits a specified website, the extension should "easily intercept" it and display a new "application" (keeping the URL and not opening a new tab or window). I am currently using a content script to manipulate the DOM, but it is too messy.

Chrome apps like Google Docs achieve the same goal with URL Handlers , but they are not an option as they are now deprecated.

I currently know two options:

  • Intercept the url and redirect to the add url. I want to store the url.
  • Use a content script to stop loading the page from document_start

    (using window.stop()

    ) and then "inject" a new application. This appears to work, but it sounds pretty hacky and prone to unexpected crashes.

What I would like to know:

  • Is the second approach good enough? What limitations and other problems will I face if I use it?
  • Is there any other approach that is at least good (and preferably designed for this purpose)?
+3


source to share


1 answer


You cannot open a chrome app in a tab, only in a window. I also don't think they have content scripts.

Also, chrome apps are now only available on chrome os when you publish for the first time (existing chrome apps work for any os).




To solve your question, you can use the content scripting extension and just open full screen iframe

so the url is saved in the omnibox and it can have the desired page in the iframe as the page it would be in the application.

Content handlers are meant to open a specific protocol url to do something like sending email, etc. Examples would be like tel: //, sms: //, mailto :, etc. So you don't want it. Moreover, they are not as noticeable when you approve the protocol.

0


source







All Articles