Can I re-open my popup after user grants permisisons? - google-chrome-extension

I'm testing edge cases for my chrome extension; handling cases where the user has not yet granted the permissions I need.
My popup calls chrome.identity.getAuthToken and, as expected, the user is show the chrome permissions screen and asked to approve.
But, as a side-effect, this closes my popup. I'd like to either keep the popup open, or re-open it after permission has been granted. Is this possible?

'Popup' is ambiguous.
A page action can be triggered dynamically using chrome.pageAction.show(integer tabId).
A browser action cannot.
I don't know about chrome.identity.getAuthToken but e. g. chrome.permissions.request does not close a page action.
I don't think there is a way to stop it closing either. E. g. a beforeUnload event listener does not seem to work.

Related

Chrome extension popup closed after requesting permissions

I am calling this API from a Chrome extension I'm developing inside of a popup context:
chrome.permissions.request({
origins: [`https://google.com/`]
}, console.log)
However, whenever Chrome asks the user via their native alert to allow or deny permissions, my extension popup is closed after Google's alert dismisses, so I cannot finish the signup flow.
If the user has already provided permission for this domain, the user isn't prompted, I get console.log(true) and my popup window does not close.
What am I doing wrong, and if nothing, is there a workaround for this issue?
I made an issue in Chromium, and their team is aware of the issue, at least. Hopefully will see released at some point!
My temporary fix is just to make *://*/ a required permission instead of optional. Then I don't need to request permissions from the user at runtime. Which tells the user "this extension can access all websites", but at least the UX isn't terrible.

Event after login

Is there any event I can hook into to show/display a message after the user has logged in ? Like welcome screen with a short message from the company. And the user needs to click a button before proceeding. Otherwise, it's back to the login screen.
TIA
I am not aware of an event which triggers on log-in. Perhaps another approach might be for you to modify the Login.aspx so that you show this message before the user logs-in. I am not sure whether modifying this page is fully supported by Acumatica however. The Login.aspx is located in the Frames folder of the site.

How to prevent Chrome from automatically blocking audio capture

I'm developing an extension that requires audio access. Under normal circumstances, the user will choose either "Block" or "Allow", and that is fine. Both actions will put the extension in the appropriate place in settings/content/microphone. But while testing, I found if the user were to simply close out the Block/Allow popup by clicking on the "x" in the corner:
then I start to get PermissionDeniedErrors from navigator.mediaDevices.getUserMedia (which makes sense). But there are two big problems to this:
Chrome stops prompting the user if they want to block/allow - it just silently blocks it.
The blocked extension DOES NOT show up in settings/content/microphone. So there is no way for the user to unblock it.
Then some time later (hours? days?), the prompt will come back.
I was digging in the Preferences file to see if maybe something about the extension is in there that wasn't getting surfaced to the UI, and I found this:
From this, I am guessing that Chrome is detecting the "dismissals", and just automatically begins blocking the setting for a period of time ("embargo days").
Is there any kind of action: either programmatic or user-based that can be taken to help direct users to unblock the extension?

Serverside Xpages application update causes my browser page partial refresh actions stop working - how to detect it?

Any Xpages application update in design causes the application refresh which removes scope variables, session etc. When this occures and there is a page opened in users browser with some partial refresh action buttons ... such buttons simply do nothing when clicked which is quite confusing. No message that's warning the user that the page is stale or something. Is there a way how to detect such situation in general so I can inform user in browser with some dialog that he should reload the entire page?
For all scope variables above request (which gets initialized when you send a request and is always shiny and new) you never can take their existence for granted. Best example: user leaves a form open, locks the PC, goes for lunch, lets the session expire (which also deletes the view scope). (S)he comes back, opens a new tab and logs in - so there is a valid (new) session, hits submit in the first tab -> bum all your code fails.
This is the same scenario as an updated design short of the scenario Panu was pointing to.
So in your code check for the existence of your scoped variables and force a full refresh. Or (I like that better) add an error to the page so that gets displayed with an appropriate action.

Browser navigation, back button issue

I want to know how you guys deal with back button issues in your web applications.
I can not forbid users to click back button on their browser, but when they hit it, the page code doesn't run. So writing in page_load() makes no sense.
I have searched online and found this link: Disabling Back button on the browser. It does not work for me. Any idea?
There is no way to disable the back button. You can try to open your page/form in a new window so there would be nothing to navigate back to
Normally, If I have a critical or lengthy form, I tend to maintain a dirty-flag and if the user starts entering something, the dirty-flag gets set and on save or submit it gets reset. You can use unload/beforeunload javascript event to see if the dirty-flag is set and ask for confirmation.

Resources