I work in a call center and we use an in-house app for dialing. The app is built using HTML/JavaScript for the front end and MSSQL/Node.js for the back end.
We have a problem where some people close the browser without logging out properly and this is causing data to be lost because the phone call is not being terminated correctly. Is there any way to prevent the user from closing the app using the 'X' button in Chrome?
I have already setup the generic Chrome message that warns of data loss if the browser is closed, but this isn't really doing the job.
I am looking for either some kind of JavaScript code to run in the app or perhaps something externally I can run on the local computer. Also, a Chrome startup command line switch would be perfect for the job too, but from my research, I am not sure one exists.
$(window).on("beforeunload", function() {
return confirm("Do you really want to close?");
})
There is no specific event for capturing browser close event.
You can only capture on unload of the current page.
By this method, it will be effected while refreshing / navigating the current page.
Ref
Related
I’ve been struggling for days trying to figure out why the Linking eventListener doesn’t seem to work. I am setting up the event listener correctly:
Linking.addEventListener(“url”, handleStravaRedirect);
where, “handleStravaRedirect” is the callback function to be called after the user grants my app permission on the 3rd party website. The problem is, this function never gets called after the redirect back to my app. I thought I was doing something wrong, but when I tried the auth flow on android, the event handler triggered as expected.
Are there any extra steps I need to do to make Linking work on iOS? It seems like iOS handles the app being pushed to the background & the redirect differently than android handles it, almost like the Linking eventListener doesn't even know the user left the app in the first place.
Other information:
To make the Auth Request and open the web browser, I’m using: AuthSession.useAuthRequest
When I log “Linking.addEventListener” right above where it gets linked, the function is there and I receive no errors that adding the event listener failed, So I’m assuming that part is set up properly and the problem is purely on reopening of my app from the browser.
I’m having the same issue in Dev when I’m using the "exp:// " scheme and in Testflight when I use my custom “herofit://” scheme.
EDIT: This seems to be very similar to the issue I'm having
https://forums.expo.dev/t/expo-deeplinking-issue-with-addeventlistener/2254/14
I resolved my issue. I was unable to read the response because, I was using the “AuthSession.useAuthRequest” hook, and trying to listen to the response with “Linking.addEventListener”. Instead, I needed to to listen for the response with “response”, which was one of the methods returned on the useAuthRequest hook.
I'm writing a chrome extension which will perform some actions when a system notification pops up. Specifically, I want to close them.
For example: the "Restore pages?" notification:
My manifest file has nothing particularly interesting, here is my event page:
function anyAlarmHandler (Alarm anyAlarm) {
// For now, just clear any alarm when one pops up.
chrome.alarms.clear(anyAlarm);
}
chrome.alarms.onAlarm.addListener(anyAlarmHandler);
But it doesn't clear the system notification as expected.
I suspect that I'm listening for the wrong event, that system notifications are not actually considered an alarm. But the 'notifications' API doesn't have anything regarding catching notifications.
I've looked at this question regarding catching notifications, which might work, but it doesn't help with the following:
I need to catch notifications created by the browser itself, not another extension (this might not matter, I'm not sure)
I need to modify that notification. Change the text, close it, whatever.
I've tried using the code in the link above and just popping some dialogue box when a notification happens (to test if that solution works for detecting browser notifications), but even that didn't work. I'm hoping that I'm just missing some method/event listener in some API, but I can't seem to find it anywhere. Any help is appreciated.
You cannot detect, or override, any of the Chrome's own UI popups like this.
Only another native app could potentially interact with them (e.g. simulate a click).
Short of patching Chrome (in-memory or on disk), you won't be able to change the wording.
I am using Django v1.10 for an application where in need to send an API call just before browser close through crude javascript (don't want to use any library for sake) preferably. I've read about window.unload and window.onbeforeunload. The first one didn't seem to work at all. The second can work but it also gets executed when there is reload or redirection to another page (it works as it should but that is what I don't want). I've tried using SESSION_EXPIRE_AT_BROWSER_CLOSE of Django which works only when a user has totally exit out of the browser (no browser process running). I've also seen answers on the web where people have suggested to open another window/tab of the browser through JS as the tab closes.
So in precise words, I want to make an API call just before browser tab close (not in any other situation).
Please help!
We've just upgraded group policies at work because of a big migration project. Nevermind... The thing is, some of our users use this java application, which reads the smart card reader. On new machines it doesn't work in IE, it has to run in firefox. The trouble is, that the first time firefox opens it, it says there's no java. As soon as you reload it, it's fine.
As users are users, they hate the thought of having to reload the page, and it's not very elegant either. As the process of upgrading anything in the company is difficult, and I'm only an entry level desktop support guy, it won't get fixed any time soon.
So I was thinking... is there any way to create a shortcut, that would open the page and then reload it once it finishes loading the first time?
It can be a shortcut to a local html file which then redirects it to the final location...
You can use a vbs:
set WScriptShell = CreateObject("WScript.Shell")
WScriptShell.Run("http://www.facebook.com/")
WScript.Sleep(2000)
WScriptShell.SendKeys "{F5}"
This one opens a page in the browser, waits 2000 ms (probably enough for the page to load) and then sends the "F5" key to the currently active window. This may not be a perfect solution, but you can extend it to match your needs.
Have you tried $( document ).ready() and insert the code in this function? This basically waits your whole page to load and after that executes the code in the function.
I have a site made in php that calls a javascript file to check for site notifications and then send them as a browser notification (ie Mozilla's Firefox Notifications, Chrome Desktop Notifications, etc.). It works really well, and some users have asked for a chrome notification. I made a basic chrome notification that uses the same code, and it works great for when people aren't using the site. However, the problem is when they're both running at the same time. Users who are on the site and who are using the extension find themselves getting double notifications.
Is there a way to make sure that neither one's code runs if the other is active?
Thanks!
The best way to do this is to mark the alert as read on the server side. That way if I have both Firefox and Chrome open and they go to pull the alert, whoever gets there first will mark the notification as read so that the other doesn't alert it.
You Can set cookie. if one script is running then set cookie. and when you start executing your code then first check if cookie is set? if yes it means another script is running. if cookie is not set then start execution of code.
hope it helps.
Thank you.