I am making a Windows 10 Web App (Project Westminster). There is a page that requires user to input something, and there's a 'save' button, and another button that leads to another page of the app.
To prevent user clicking the wrong button and lost his/her data before saving, I implement the JavaScript confirm() method to ask users to confirm before leaving.
This is working on iOS, Android, or Edge browser on Windows 10, but not on the Windows 10 app. The prompt does not show up but the page also does not exit, as if the user has already pressed the "stay here" button.
How can I make this work as expected? Thanks!
Windows will not let you prevent the closing of an app of the user chooses to, so the best way to handle this would be to save the data on the Suspending event and load it again when the app resumes.
Here's a sample that might help you get going.
Related
I have a CRM developed in PHP. I am developing an attendance system so that when a user logs in the CRM and clicks on the 'Shift Start' button then the agent will change that browser tab or minimize that tab and work on his system.
I need to check that the user is still using his system - I mean pressing the keyboard buttons and moving the mouse.
How can I detect that the user is active on his system or not as that tab is inactive or even he minimize his browser. Any jQuery code or suggestions please.
The challenge you have is that it seems your CRM is only used to start the shift, and the actual work is happening outside of the CRM. If so, any JavaScript code you develop and place in your CRM will only be able to detect mouse movement "inside" the browser window of the CRM.
Once a user's cursor goes "outside" the window (or in another tab), you won't know what it's doing. This is a good thing from a security perspective, and there is (fortunately) no way around it.
I am working on a PWA and I have a page with a full screen modal in it, which pops up upon a button click to perform a specific action.
On the modal I have a close button tied to a function which works fine in closing the modal. However I noticed that on most native apps, when a modal is active clicking the (android) back button in a UI like mine closes the modal instead of going to the previous view.
My concern is if it were possible to listen to the android back button being clicked, prevent the default action and call another action. Or if there's anyway else around this!
I've made researches but all I can see is handling the browser back button, which in my case does not work. Tested on samsung A30,S10,A50.
From the Suggested question which I had gone through, There's no answer concerning how to handle the back button, Only on how to intercept it. And none of those answers my question.
Kindly note, PWA is already installed, hence in standalone mode
There is no way to handle the back button of Android in the PWA environment.
It is a system button which "clicks" the history.back() of an open browser. If there is no back-history it closes the browser.
But it doesn't know anything about this special button. There would be the need for something like the keypress-events. But there is no standard and so no implementation in the browsers.
The only way to handle this stuff in your app, is to manage the history.state in your app.
Push a new state with opening the modal. And close the modal in the popstate-event.
https://developer.mozilla.org/en-US/docs/Web/API/History_API/Working_with_the_History_API
I have a download link in my application. If user clicks on the link, then a default open save dialog box is popped up in a new window in IE8. Also, user can't navigate anywhere till he clicks on open or save on this prompt.
But, the open save dialog is different and comes at bottom of the page in IE11 as given below. And also user can navigate anywhere in the application without responding to this save prompt. The problem is that this prompt is still there even after the user logouts from the application and can open or save even after logout.
Is there any way to force the user to respond to open save dialog and then only navigate to other pages in IE11 or force dialog to close if user logs out ?
IE8
IE11
Unfortunately no, this is just the browser behavior and it cannot be altered, for good reason too. I would not want websites to have any control over download dialogue boxes that my browser presents to me.
If your goal is to prevent a user from downloading a file unless they are still logged in, you may serve the file via a script on your server, which first checks the login status before sending the file to the browser/user.
I am developing a SharePoint App that basically launches a form in a Windows 8 application once the action is clicked. This is working perfectly fine. However, once you select this action, you are redirected to a page that basically holds some parameters to launch the app. This page throws a window that asks the user if it's okay to launch the app:
How can I detect if this has been launched or not? Ultimately I'd like to detect if the user hits 'Allow' or 'Cancel' but either scenario will work. I am trying to redirect a user to the parent page once this window has launched (hopefully when the user clicks 'Allow'
Is this possible? I found a helpful thread here: http://support.smartbear.com/viewarticle/55730/
However, this thread is very useful but doesn't give me the answer I need. I've tried using jQuerys .blur and this works(ish). It isn't giving me a consistent response but looks like it's a step in the right direction (if I can't detect the window that launches). I've also tried the following code by using .hover but am receiving inconsistent results.
$(window).hover(function (event) {
if (event.fromElement) {
console.log("inactive");
window.location.href = "http://google.com";
}
else {
console.log("active");
}
});
At the highest level possible, I'm trying to redirect the user once the app is launched.
Thanks in advance for any helpful input.
I have a application that allows a user to choose some parameters for a powerpoint report, run the report, then allow the user to "save" or "open" the powerpoint file. I got all of that working OK. When you click on "run" report, it pops open a window which generates the report, stores it in session, then closes the window. I have a button on the main page that will export the report.
So, now, when the pop up window that generates the report is finished, i use "window.opener" to call a javascript method on the main page, that will do a javascript click of the button. when this button is pressed, Internet Explorer gives me the following message : "To help protect your security, Internet Explorer blocked this site from downloading files to your computer.."
Do you guys know of any tricks around this?
The browser doesn't like it when you try to make a download happen from some context other than a user-triggered event (like a "click"; maybe only a "click"). The user can adjust the security setting, but obviously that's not a solution for most people.
Really the only thing I know to do is to re-think the way that users interact with your pages, so that you can make sure that only actions invoked directly from button clicks (like, URLs that are the targets of form submits, for example) return a download. It's a pain.