Google Chrome Extension, closing Persistent background page - javascript

I have a chrome extension which has a persistent background page in order to stream audio even when the user closes chrome. What I would like is to implement an option for the user to disable audio streaming after chrome has been closed. Right now I am detecting when all chrome windows have been closed and pausing audio, however chrome remains 'open' in the task manager and system tray (note that running in background chrome setting is enabled). This stops audio playback but the chrome process remains open in task manger and the icon remains in the system tray. By contrast if I completely disable the extension and then close chrome, the application closes completely and no system tray icon remains.
This Question suggests that only a user can explicitly close chrome if there is a persistent background page, My goal isn't to close chrome explicitly but simply prevent MY extension from being the one keeping chrome open (depending on user specified options), therefore an event page doesn't seem to be a good fit.
Is there a function call or some other programmatic way I can close my persistent background page once all windows have been closed, if that option has been enabled? Or am I stuck with the chrome application staying open because the background page is persistent?

I've found an answer to my own question so I'll post it here. In order to have a background page you do not need the "Background" permission declared in your manifest. This permission is what allows the extension to stay open after chrome has closed (and potentially open before chrome?) rather than being necessary to have a background page. So a persistent background page will close with chrome if this permission is not set, and will stay open even after chrome is closed if it is set.
Bearing this in mind, the solution for me was to set the "background" permission to optional, and enable it if I wanted my extension to stay open after close, then remove the permission if I didn't want it staying open after close (the user now has an option to toggle this).

Related

chrome extension - usage onChanged in background.js, content_script.js and iframe

I'm developing a chrome extension.
The scenario is as follows:
I use background.js that controls the notification settings of my extension.
Content_script.js, which captures information from the current window and inserts an iframe page of the same extension.
Frame_content.js: This is a tab that appears in the right part of the window and that when it is clicked it is displayed.
Example:
step 1
http://oi67.tinypic.com/kcm336.jpg
step 2
http://oi64.tinypic.com/28w1pp3.jpg
I am using chrome.storage.sync to communicate between bg.js , Content_script.js and Frame_content.js and display the tab depending on whether or not it is clicked.
My problem is that when using the listener chrome.storage.onChanged.addListener, it modifies the storage of all chrome windows and open all tabs. I need it to work ONLY in the current window.
That is, when I click on the tab it is displayed in all the browser windows and when I do it small happens the same.
¿Any solution?

Chrome extensions disable reopening of an extension created tab

I couldn't find any similar question to this, but is it possible to create a new tab within chrome extension (using chrome.tabs.create) and then after closing it using the same extension prohibit user from reopening it using ctrl+shift+t or undo close tab command?
You can open an incognito tab; it will have the requested behavior.
I don't think you can clear session data, and simply clearing history does not prevent reopening.

How to disable minimize in ie

I have thin client station, we are using Web Browser Control(the taskbar and start menu are disabled) Web Browser Control is the only option that user can access to the internet.Every thing is fine till here.But there are Particular Links in some pages where new IE window will open(Page will open in new ie window). If the IE Window is minimized the user's cannot see it. If there are 20 of IE7 minimized then the system hangs.
i cant use Kiosk Mode (iexplore -k). because user should allowed to close.
I cant change web pages.
But i Can inject Javascript(no Jquery) in to the Pages.
How Can i Hide/Disable Minimize, if i cant is there is any work around for this.

Trying to make a web browser tab glow/flash in chrome and firefox

I am trying to get a web browser tab glow or flash when activity occurs on the page. I can handle telling when it needs to trigger, but I cannot figure out how to get a tab to glow. This may also be solved by a tab indicator.

Exit Chrome Extension w/ Background Permissions on Browser Close

I am building a Google Chrome extension that requires background permissions in order to be able to stream music with the extension closed. I run a script in the background that creates an audio element and plays music, and the [foreground] extension can play/pause. However, when the user exits the browser, the controls go with it! Because of the very nature of background permissions, the extension keeps running and streaming music. But the user can no longer stop it without reopening Chrome.
Please tell me there's a way around this? I want my extension to play music when the extension is not in the foreground, but I also want to quit/stop when the user exists the main Chrome window. To be clear, this is not a background "page" running, it's a javascript file.
Thank you!
You don't need the background permission to have a background script. You can simply remove the background permission from your manifest.

Categories

Resources