Search code examples
javascriptpluginsgoogle-chrome-extensionnpapifirebreath

Google Chrome Extension and NPAPI/FireBreath embed webpages


I am developing a project where i intend to open multiple webpages in the same one but not using <iframe>. I have tried in the past using <iframes> but i usually end up with the browser UI locking the webpage, so i have been trying to find alternatives.

I developed a small google chrome extension where instead having opening webpages, i open chrome.windows in the position i want and it works fine, but i wouldn't want any UI around them like the title bar and the buttons like a sort of 'fullscreen' for the dimensions i defined.

chrome.windows.create({ url: app.src, left: wleft, top: wtop, width: wwidth, height: wheight, focused: false, type: "popup" }, function(tab) {
    self.windowid = tab.id;
    console.log('Window ID is: ' + self.windowid);
    //chrome.windows.update(tab.id, { focused: true, state: "maximized" })
});

While looking into chrome extension API i read something about NPAPI and with a little more research i have found about FireBreath. Since i have never did anything with this i have doubts if there is any way or possibility, by developing a plugin npapi/firebreath to do 1 of the following:

  1. When opening a window with chrome extension, somehow remove the UI from it?
  2. With the development of a plugin and having an index.html with 3 <object id="plugin"...> instead of the <iframe>, and inside those 3 object embed on the index, make them open webpages with url that i define and make it change the url after X time that is set on javascript?

This is all assumptions, idk if i am saying anything stupid regarding the possibility to do this with npapi or if i should look somewhere else.

Thanks in advance.


Solution

  • Basically the answer is no, you can't do any of that.

    To be more accurate, however, you can do #2 but it's a huge amount of work and may not work how you expect. The only way to load an html page inside an npapi plugin is to actually embed a web browser of some sort into that plugin; FireBreath has an undocumented library called WebView that will do this for you, but it uses the IE engine on windows and on Mac it uses a lot of hacks to make it work which end up only working correctly in certain cases.

    Your #1 can't be done in any consistent or reliable; npapi plugins know nothing about the browser itself, only the page. It might be possible using windows APIs to essentially hack into the browser window and change things but it would be very fragile and implementation specific to that version of chrome; if something changed later it'd just break.