Polarbearcv Posted December 22, 2021 Share Posted December 22, 2021 I'm using this "popups" script from w3schools.com https://www.w3schools.com/howto/howto_js_popup.asp I would like that the popup doesn't close when you click in the popup itself (I want to be able to copy some text from the popup). The popup should only close when I click the link again. Is this possible? Link to comment Share on other sites More sharing options...
JamesL Posted August 30, 2022 Share Posted August 30, 2022 Yes, it is possible. But you need to add some more Javascript to handle this. Break it down to smaller tasks: 1. Click link to open window and set an event listener to monitor the popup window 2. Popup window also checks to see if it has focus. If not, it sets focus and brings itself to the front. 3. The 'opener' window monitors to see if the popup has focus. If the user clicks on the opener (anywhere but the link), it should return focus to the popup. 4. The only exception is if the user clicks on the link from the opener window. If they do click it, an event listener is triggered, and closes the popup window. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now