Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I stuck in the problem. I am working on website where I have main page, we can say it Parent page. And through that I am redirecting to other pages in new tab only, to them we can call as Child Page. My question is that, how I can detect on child page that the parent page tab has been closed by user?
I don't know where I can use Javacript or PHP to detecting on every child page.
I want to get the detection on real time. I mean, I do not want to execute function in every 1 minute which check for the value to detect that the parent page was closed.
You can capture the window.onClose event in the parentwindow and send a value to the child window when this happens (set a variable in the child window). Note that the only way to get a reference to the child window is through the return value of window.open(). window.beforeunload might be more widely supported, but it also fires when you go to a different page of your website in the parent page-- this is actually more useful in some cases, especially if the user goes to a new website using the same tab. See How to capture the browser window close event?.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm looking for a reliable way to get a browser window always on top. I know some old methods like window.focus(), blur events and so on but they don't work anymore.
I was wondering if there is some kind of way to get the user trust to keep a specific browser window always on top on the desktop.
The use case is simple. I'm letting the user to capture and record their screen and I want to let them record their face as well. For that, I'm opening a popup (window.open) and enabling their webcam. This window must be always on top in order to get their face always visible when the user is managing other windows.
Is this achievable? Thanks!
I don't think what you're asking for exists, no.
The closest that I can think of is the fullscreen API, but that won't work for your use case — it sounds like you want other windows to be visible, just not on top.
I think you'll have to use user training to get the best results you can, telling them to be sure that their face is visible and not behind some other window.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Is there any way to take screenshot of previous active window from our web application? As of now I'm using html2canvas to take screenshot of current window of my webapp, but I need to take a screenshot of my previous active window.(Ex : if I open eclipse first and then open my webapp, from webapp I want to take a screenshot of previous active window means eclipse.)
Is it possible from angular or javascript?
No.
JavaScript running in a web browser is sandboxed and instances where it can interact with applications outside the browser are extremely limited. Taking screenshots of other applications is not one of the exceptions.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Several pages in my AngularJS webapp are being created through a custom directive that I wrote. The browser back button in all pages where the directive is not used works as expected(pressing the back button loads the previous page).
But in the case of the custom directive web pages, pressing the browser back button just reloads the current page that its in.
How do I get the back button to work as expected in the custom directive pages?
Do I have to inject any angular services, or do i have to write my own function
to handle the back button event?
Thanks for your suggestions.
It looks like you are changing window.location property somehow in your directive and Back button visually refreshes page where in reality it returns previous value of location property
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
how can I prevent user exit firefox?
I want that user woldn`t leave page before all required fields are filled.
I would be happy to see full example...
Thanks
You can't stop someone from closing the browser, or navigating away from the page, if that's what they want to do. It's their browser - you can't force them to do anything.
That said, you can pop up a message by hooking the onbeforeunload event and returning a string if there are still actions you want them to perform. Most browsers will then display this string in a dialog asking whether they really do want to navigate away (or close the browser etc), however the Firefox devs have taken the stance that that is a security risk and will only present a generic message instead. Even with this in place, the user can still choose to close the browser or navigate away.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I open popup window from Javascript that redirects to different domain. User performs few steps there and at the end popup is closed and the result is passed back to Javascript. I've tried calling window.opener.myfunction but it doesn't work with different domains.
Is it possible to achieve that? I think problem is similar to Facebook connect, where in Javascript I get result of the authentication performed in popup window.
It doesn't work for different domains because the Same-Origin policy applies and restricts access of scripts executing from a different domain. What you could do is pass the parameter as part of a query string argument:
Popup Window Opens -> http://mydomain/popup?name=value
http://mydomain/popup?name=value -> http://externaldomain/target?name=value
Through which the other domain would pass back the same parameter:
http://externaldomain/target?name=value -> http://mydomain/result?name=value