My webapp opens a popup window and then, after an AJAX request in the main window, it updates the URL of the popup window.
As I found out, on iOS devices, Javascript doesn't run in the main window when it's in the background (because the popup opened).
This seems to be a reasonable decision for the engineers who designed the mobile Safari to conserve battery power, so I can imagine other devices out there doing the same. (Are there?)
Now I could open the popup URL in the main window instead. However, since this provides worse user experience for browsers that can run Javascript in the background, I would like to detect this behavior beforehand. What would be the best way to do that?
Related
I am Developing a React Application for online MCQS exams. I want to restrict the user to not leave the exam screen until it completes the exam or time goes over.
I used React Full-screen component for full screen,but on pressing the esc button it leaves the full screen.
Is there any other way to achieved full screen rather than Full Screen API.
Or any other way to implement the restrictions of online exam conduction.
Also I want to Handle Some Key combinations like Alt+F4 , Ctrl+Shift+Tab.
I have used the Event Handler for the keyDown for esc button. but it fires after the full screen closes.
Also I have Used Event Handler for F4 and all keyboard keys. but Alt+F4 close the browser.
I think it's not possible to force a website (or web application, respectively) to stay for an unlimited time in fullscreen mode. The reason is pretty simple: user security. As Craig Buckler explains in this blog post:
If you can force an app to run full-screen, the user loses their browser, taskbar and standard operating system controls. They may not be able to close the window or, worse, nefarious developers could emulate the OS and trick users into handing over passwords, credit card details, etc.
I guess the only possibility would be to configure the web browser on a specific computer to always run a certain page in fullscreen mode. But I guess that would require administrator rights and probably not all browsers might have flags or configuration options for this.
Edit: Another option would be to create a standalone executable file that opens a pre-configured browser instance in fullscreen mode. Have a look at Electron for desktop or Cordova for mobile devices for instance. But please note that this might take much more time to build and deploy than just programming the web app itself, if you have never worked with one of these tools before.
Mobile Safari and other iOS web browsers (e.g. Chrome) sometimes remove tabs from memory in order to make room for new tabs. This causes the tab to refresh upon regaining focus. The web application I'm developing depends heavily upon JS-rendered content and I'd like to be able to restore that content if the page gets removed from memory. I'm already able to do this using the localStorage model. However, I don't want to restore the content if the user refreshes the page on purpose (by clicking the Refresh button). Is there a way to differentiate between the two actions, from JavaScript or otherwise?
I'm trying to make Mozilla FireFox plugin showing notification. Notifications are visible for Windows and even Mac I want the user to click the notification and open the web page, it sounds pretty simple.
But when adding observer and making window.open or gBroswer.addTab window is opened and tab is opened but in case FireFox is minimized when the notification is shown windows are opened in background and not visible to the user.
Tried to use Components.interfaces.nsIAlertsService and chrome://global/content/alerts/alert.xul they work the same from this perspective.
Is there a way to tell the browser to be top most and be visible to the user?
It doesn't look like this can be done. Firefox generally only supports switching focus between different browser windows when one of them is already focused (via window.focus()). To handle notifications the way you want it (and the way Thunderbird does it) one would need to call SetForegroundWindow() on Windows - there are only two occasions in the Firefox code where this function is called. One is when a new Firefox process is started, the other is when one Firefox window is being minimized. Unfortunately, in this case neither can really be used and Thunderbird indeed uses custom code rather than existing XPCOM APIs to bring itself into foreground.
Is there a way I can maximize a currently minimized window from Javascript? Here's my situation:
I have a series of links that all target the same external window (e.g. "MyNewWindow"). When I click a link, a new window pops up. If I click another link, the page pops up in the same window as expected. If I minimize the "MyNewWindow" popup, I'd like to be able to click another link and have that window maximize.
My approach was to put something on the onLoad part of the body so that when the page is refreshed it will automatically "maximize" if it is minimized. Note: Using window.MoveTo() and window.resizeTo() doesnt seem to do the trick (the window stays minimized).
Thanks!
For all of you know-it-alls, there are perfectly good reasons to want to know how to do this. Here's the reason I needed this:
I'm deploying SCORM modules to a variety of Learning Management Systems (LMSs)
One LMS that a client is using launches the module in a small (600x400) window, with the user controls to maximize or resize said window DISABLED
The client doesn't know how to change this launch behavior
My only option is to try to maximize via javascript, because the idiots who made the LMS took away the user's ability to manage their own windows.
window.moveTo(0, 0);
window.resizeTo(screen.availWidth, screen.availHeight);
This may not work in IE depending on the security zone your page is falling under, and it may not work in Chrome at all. But for a corporate environment in an intranet, it has a good chance of working.
Don't do this, you are not allowed to do this by most modern browsers for a reason.
In a tabbed environment you're not messing with only the window you may have created, but all of my tabs, that's unacceptable. It's the user's computer, user's browser, it's the user who chose to go to your site...let them size the window the way they want it, doing anything else breaks their experience...and their trust in your site.
The behavior you're looking to emulate is what your run-of-the-mill malware does...re-think your approach, please. For example focusing that window is appropriate for what you want, let the default behavior of the browser take over from there, like this:
var thatWindow = window.open(url, "linkWindow");
thatWindow.focus();
try to use window.open(url,fullscreen=yes);
if you out fullscreen=yes than while clinking on link automatically
What is the difference between Popup , chromeless window, modal-window, lightbox, hover ad?
Which is unblockable with default setting on any browser, more accessible with screen reader and even accessible if javascript disabled?
Popup: Anything that pops up from your browser. They tend to annoy users, and therefore they are often blocked by the browsers.
Chromeless Window: Just another kind of popup window that doesn't show the browser menu or toolbar.
Modal Window: The JavaScript alert() method is an example of a modal dialog. The users must acknowledge the popup before they can return to operate the parent application.
Lightbox: A modal-dialog JavaScript implementation normally used to display images. Requires JavaScipt and it isn't blocked by browsers unless JavaScript has been disabled.
Hover Ad: These are implemented in JavaScript similarly to Lightbox, but are not modal so the users may continue using the parent application. They are used for online advertising solutions and most implementations do not scroll with the web page, and therefore may obscure some of the content. While there is a big chance that Hover Ads may annoy users, they are quite difficult to block.
Depending on the Browser you use, Internet Explorer and Firefox completely blocks the pop-ups with JavaScript Disabled, Google Chrome on the other hand lets Alert Boxes and Announcement boxes still pop-up.You can test it here using your Google Chrome Browser: Alert Box