Pop up Based Notification - javascript

I am implementing a pop up based notification system where logged in user will receive a pop up on the website. But the problem here is when user is not on the browser and working on some other tools like excel, in that case he/she will not able to take action based on that pop up. Is there any way to focus on that window which has received new pop up.
Thanks in advance.

Related

Notification is not closing when multiple application tabs are open

When the application session times out, I display a dialog to the user saying "The session is about to timeout" and I display 2 buttons on the dialog "Signout" and "StayLoggedIn".
Along with this dialog, I display a desktop Notification to the user which warns the user about the session timing out.
When I click on the 'SignOut' or 'StayLoggedIn' button on the dialog, I need to close the notification too along with the dialog.
I am using Notification.close() to close the notification.
The Notification closes fine when I click on the dialog buttons when I just have one application tab open.
But if I have 2 application tabs open(eg - google.com,google.com) and click on the dialog buttons in one of the tabs, the notification.close() gets called but it does not close the notification.
Anyone came across similar issue? I am stuck. Need help please. FYI I am on Chrome version 78.
Every tab in chrome is a new process. Windows 10 is process isolated with toast.
The toast created in process A can not access a toast created in process B and vice versa.
Toast notifications usefulness came and gone with the focus assist feature. So honestly I would skip using them in any new app.

Modal popup on window close using javascript/jquery

I have a website where the customers come and purchase any product. But there are some customers who closes the tab without doing any purchase. I don't want to lose those customers. So i have decided to provide offers for those customers in the "modal" popup. This popup has to be displayed once the customer clicks the close button in the browser. This popup will have a form to select the offers, fill their contact details and submit the form. Once the form gets submitted, the window can be closed automatically. Is it possible to provide such a popup modal. I have surfed regarding this. Everyone says about the onbeforeunload with confirm and alert box. Could anyone help me on this.
What you are trying to do cannot be done. That is after the user has clicked on close there is no way to do it.
But I think what you are looking for is what is called a 'Exit intent popup'.
The idea is simple: you use js/jquery to find if the user is 'about to' close the page(say from mouse movements and such) and display the said popup.
Here is one such plugin : BIOEP
You can just google 'Exit intent popups' for many more.
you can't do it from your page code,
only place I see this is in extensions.

How facebook/twitter share buttons avoid being blocked by popup blockers?

When a user which is not logged in to Facebook or Twitter, clicks the like/tweet button, a popup comes up asking the user to log in. This popup is not blocked by popup blockers of any kind. in IE for example, it opens up but anyway IE state a warning to the user. The bottom line is that all buttons probably use the same method.
I have a button that people click on it and it should open a similar screen, but it always gets blocked.
The button (in JS) works pretty much like FB like button. It checks if the user is logged in. If he does, then send the "like" to the servers. If he does not, then the login popup appears (and gets blocked).
So, it is a initiated by a user although not fully direct outcome, since we need to check if he logged in or not.
What is best method to do that?
The Popup Is activated by a click using the like, tweet button and they actually show only 1 popup. If you want, you can try by using only a single popup based on click for your website and you will definitely be able to understand this.

Can you change text "XXX Wants to use your location"

When a website requests for permission to use the users location through html5, is there a way to change the message that pops down?
Ultimately, I would like to have a pop up dialog, that would tell them why we're asking for their location, and if they press yes, it automatically 'accepts' or creates permission to use their location, rather than them having to press 'okay' twice, effectively.
So, Can you change the browser text?
And, can you control the button in the browser dialog/popdown?

Check if User has clicked "Ok" for "onbeforeunload event"

I am checking when the user closes the browser window, if he says ok, how i do I trigger some action, like opening another window or saving a form. If he chooses "cancel", it should stay in the same page (which is working now). pls share some idea on how to approach this issue
Sample Code
You cannot react to the user clicking on the "Leave this page" button. This is by design of the browser: if the user wants to leave, let him go.
If the user chooses to cancel, you can try a technique found in this answer to similar question to execute some custom code like saving changes or the like.

Categories

Resources