Chrome auto tab discarding disable java script? - javascript

Chrome implement new feature which is called auto tab discarding through this feature enable user when user not on the tab that tab will discard and when user re click on that tab chrome auto refresh that tab. here is the link of Article. this is is very good feature But my problem is I'm showing notification when our tab is active in chrome but because of this feature our Tab is discard and not able to show notifications anymore.
My Question is :- How to Disable this feature or there is any way to keep my tab active or any way to prevent that from discarding?

Users can switch off automatic tab discarding by setting the respective flag in Chrome using this link: chrome://flags/#automatic-tab-discarding
But every page with states depending on user input do have the same problem like yours. Usually, you can prevent unloading a page with handling the onbeforeunload event in JavaScript. Unfortunately, Google does not prevent a solution for this on all systems, despite many users had problems with this feature already in the experimental phase, as you can read in the user comments:
https://developers.google.com/web/updates/2015/09/tab-discarding
For ChomeOS, the problem seams to be fixed:
https://bugs.chromium.org/p/chromium/issues/detail?id=123049
On Android, automatic tab discarding is quite aggressive and prevents using Chrome for applications with significant user input, imho.
On Windows, automatic tab discarding only starts if the available memory is low.
Sorry for not coming up with a proper solution here (I'd be really happy to have one) - I did extensive research and this is all I could find.

Related

Prevent getDisplayMedia from changing focus

Using chrome, a call to
navigator.mediaDevices.getDisplayMedia()
will forcibly focus whatever it is you chose, either a tab or window.
This is not very user friendly given my particular use-case of wanting to stream multiple tabs, as you would have to renavigate to the particular tab that calls this api every time you start a new stream.
Is there any way to get around this barring automatic tab refocusing after media selection?
A chrome api solution is welcome since I am making a chrome extension.

Chrome Notification API (for Extensions!) How to Re-enable Once Blocked?

I have spent considerable time researching this and hopefully I have just missed something so I thought I would bounce it off the StackExchange community as well.
Background:
On latest Chrome > 65, all of the notifications are stores on a per-site basis, so if one were to grant or deny notification popup for a SITE and want to reverse that decision (accidentally clicked the "block" for example) they can simply go into Chrome notification settings, find that specific site, and remove the block. This works as designed today and is well documented.
So here is the issue detail in a scenario:
Now, that exact same mechanism is used for extensions. An extension is initially granted all it's required permissions and works properly. Then, the user accidentally clicks "block" one time on a single desktop notification from the extension using the "gears" cog-wheel icon on the notification which then changes the notify balloon to this prompt:
Now, any time that extension attempts to send a notify message, instead of the normal desktop notify, an ugly javascript notify pops up in the middle of the screen (with the exact same notify text), and two buttons - "OK" and "Cancel". All extension functionality is unchanged if "OK" is clicked for example, the very same functions fire as if the user had clicked the prior desktop notify balloon popup.
Here are two screenshots of this exact scenario using the popular Tampermonkey Chrome extension (using a randomly selected script with a known update) that uses desktop notification API to communicate script updates:
"Normal" desktop notify message with default grant permission:
The exact same message (appears in center of the screen) once that permission is revoked by user clicking "block". **Note the actual message itself is not blocked which I find odd, just the desktop notify GUI bubble:
So, the question is really 2-fold:
Where does Chrome store that boolean value of PermissionLevel FOR EXTENSIONS - as they do NOT appear in the normal list of granted/blocked SITES. If not in the UI, is this setting exposed in a configuration file or is there even currently any way in Chrome>65 for the user to ever reverse this decision?
Is there either a programmatic method that can be implemented by an extension developer on the back-end to ever check if this has occurred and re-prompt the user to change their mind and re-grant that permission? I have found a couple unofficial posts here saying common sense says no to avoid malicious harassing of users etc. but I cannot find anything official.
Well, I can confirm after opening this as an official Chromium bug, that it's sitting waiting for triage and clearly has no current workaround here:
https://bugs.chromium.org/p/chromium/issues/detail?id=825497
I also did further testing to determine you can use the ID from the extension and add it into "sites" settings which also based on that behavior, appears to be yet another bug due to some settings not saving, none having desired effect, etc.
I will post this as the current answer as of 04-09-2018:
"it is impossible to re-enable Chrome desktop notifications FOR A SPECIFIC EXTENSION once blocked".
If anyone can post here a successful workaround to in any way re-enable the normal desktop notifications for an extension (tested with Tampermonkey) after the user clicks the "block all notifications from this app" to simply reverse the decision that would be great but I think as long as this has remained unanswered makes me lean towards believing there simply is no current method and it is just a (glaring) UI bug.
Sadly the only method for reversing this is to remove the extension and re-install it.
This issue has been open for nearly half a year. Not expecting a fix any time soon at this point. https://bugs.chromium.org/p/chromium/issues/detail?id=825497
Please star this issue at the link above if you're affected by it.

Javascript disable switches current tab functionality in browser

Is there a way to accomplished this on browser?
Disable opening another web page
or disable switch current tab functionality in browser
when certain page (in this case my page) is still open?
I want to make a quiz in web, but i want to eliminated the posibility for user search on internet for the answer, but have no idea how to accomplished that.
plis give me a solution..
regards..
No, this isn't possible, for (what I hope are) obvious reasons.
This not possible.
Even if it was possible in theory, how would you stop the user opening another browser (different brand to the current one)?
How would you stop the user from using their mobile phone to search the web?
If this quiz is being run in a controlled environment (like a classroom) you could run the web browser in some sort of kiosk mode with strict policy setup against opening other tabs etc. But if it is being run in a classroom, then you already have someone supervising anyway. Why bother then

Can we disable browser's buttons(back/forward/refresh) by javascript [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Disable browser's back button
Is there any way to disable browser(specifically IE) BACK button, FORWARD button, REFRESH button by javascript. So that, when ever any user will click on any button nothing will happen.
No, you cannot reliably, reasonably do that. Even IE's "kiosk mode" allows back, forward, and refresh (via keyboard shortcuts).
On an actual web page (a real page out on the web), disabling back/forward/refresh would of course be extremely inappropriate behavior and I assume that's not what you're trying to do. (Instead, use history libraries and such to ensure your page/web app actually works with the back and forward buttons to do what the user expects.)
Mind you, if you provide a link that opens a new window (which will probably actually end up being a new tab in most modern browsers), your page will be the first page in that window's history and so the Back button will automatically be disabled. And if your page doesn't offer any links anywhere else, it'll stay that way. And if the user hasn't gone Back, by definition they can't go Forward. Nothing you can do about Refresh, though.
If you have a genuine reason for actually disabling those actions (some kind of intranet application, that sort of thing), you'll probably have to distribute an actual application (for instance, .Net app via No Touch Deployment or similar) that incorporates a web browser control, which gives you the HTML/CSS/JavaScript environment but with dramatically higher control over that environment.
As far as I know, you can't modify the buttons in a browser with scripts.
Since you're working with IE, you may be able to use either VBScript or JScript, but I doubt you'll be able to disable the reload button.
More reading:
http://www.webdeveloper.com/forum/showthread.php?t=62177

How to get TAB event in Internet Explorer 8 using JavaScript

I have an application which had developed according to IE6.
Now Because of IE8 tabbing features not the application have been start giving problem.
The Problem is that,
if I have opened first context in "tab1" and then open second context in "tab2".
Now when I back to "tab1" and refresh the page then it loads the second context that is new one.
This is logically correct but I want to block the user while opening the second tab so that user restrict to only first tab.
So I have been come to conclusion that we can do this with JavaScript by getting some tab event, but I am not too much familiar with JavaScript.
Please tell me is there any solution if you have in your mind for above problem,
or tell me is there any way so that we can catch the tab event.
Praise all things glorious: There is no way to prevent a user from opening a new tab. In Firefox, you can cruelly prevent a user from using keyboard shortcuts to open a new tab by returning false from an input element's onkeypress event, but it's still possible to open a new tab otherwise.
The solution? Well, from what you're saying, it sounds as though you're using the session to store the user's current page (and, well, most everything else, but that's another story). Having spent a lot of time using a web application that was built that way, I can tell you firsthand: don't do this! The web already has a wonderful method for storing the user's current page: the URL.

Categories

Resources