Persistent iFrame in Chrome Extension

Does anyone know if it's possible to have a permanent iFrame in a Chrome extension? I currently have an iFrame running on a background page, but I would like to be able to see it by the user (this is a video player, so even if the video is playing, the user does not click on the controls). The goal is that if the user closes the extension popup, the video is still playing, and when they click the popup again, the video is still playing and they have access to the controls. It looks like this was previously possible with importNode / AcceptNode, but it looks like they were removed from the API.

Any help would be awesome!

thanks

+6
source share
1 answer

This may not be possible with iframes - it looks like the spec has been changed to reload iframes whenever they are moved using acceptNode.

In this case, I see two alternatives:

  • Use content scripts to track the place in the video, and whenever the iframe with the video moves between the browser popup and the background page and reloads, you then only search for the video at its location. This is not the biggest user experience, as it will hiccup.

  • Instead of playing the video on the original page and trying to move it back and forth between this and the browser popup, instead, it is always easy to load the video in a regular popup. You can create a type = popup window with chrome.windows.create and then minimize / restore it with chrome.windows.update to switch between minimized and normal states , possibly minimizing it automatically when it loses focus . This is not the best user interface, because there will always be a minimized window that is not "hidden" from the user window management system, as it would be if there was a video on the additional extension page.

0
source

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


All Articles