javascript new fullscreen API could not call using kinect's event - javascript

I'm trying to call element.requestfullscreen() function but i get following warning on mozilla console..
Request for full-screen was denied because Element.mozRequestFullScreen() was not called from inside a short running user-generated event handler.
I know what it means but how can still i call it using that event which is not connected to any element?

You're receiving the error because requestFullScreen requires a user action (generally a click, or key press) to launch into full screen. This is to prevent sites completely hijacking your browsing experience, and from embedded (or untrusted) content from trying to launch full screen, without proper action.
In order to fix this, you'll need to have the requestFullScreen trigger on a chain, that starts with that user action.
Here is a link to the relavent security/privacy considerations of full screen in the w3 spec.

Related

expo-linking: Linking back to app doesn't trigger eventListener on iOS, works fine on android

I’ve been struggling for days trying to figure out why the Linking eventListener doesn’t seem to work. I am setting up the event listener correctly:
Linking.addEventListener(“url”, handleStravaRedirect);
where, “handleStravaRedirect” is the callback function to be called after the user grants my app permission on the 3rd party website. The problem is, this function never gets called after the redirect back to my app. I thought I was doing something wrong, but when I tried the auth flow on android, the event handler triggered as expected.
Are there any extra steps I need to do to make Linking work on iOS? It seems like iOS handles the app being pushed to the background & the redirect differently than android handles it, almost like the Linking eventListener doesn't even know the user left the app in the first place.
Other information:
To make the Auth Request and open the web browser, I’m using: AuthSession.useAuthRequest
When I log “Linking.addEventListener” right above where it gets linked, the function is there and I receive no errors that adding the event listener failed, So I’m assuming that part is set up properly and the problem is purely on reopening of my app from the browser.
I’m having the same issue in Dev when I’m using the "exp:// " scheme and in Testflight when I use my custom “herofit://” scheme.
EDIT: This seems to be very similar to the issue I'm having
https://forums.expo.dev/t/expo-deeplinking-issue-with-addeventlistener/2254/14
I resolved my issue. I was unable to read the response because, I was using the “AuthSession.useAuthRequest” hook, and trying to listen to the response with “Linking.addEventListener”. Instead, I needed to to listen for the response with “response”, which was one of the methods returned on the useAuthRequest hook.

onbeforeunload works different on Chrome than it does on Firefox. I am looking for any potential alternatives

I am trying to add a onbeforeunload to my code so it fires a message that is sent to a server. I am encountering the following issue:
On page refresh, the message is sent to the server when using Firefox. It does not send a message to the server when I refresh the page on Google Chrome.
When clicking on links on my site to navigate to different sites, the server gets a message only when using Chrome. Firefox does not send a message when clicking on external links.
I also know that onbeforeunload is supposed to work when the window is closed, you enter a different website and navigate to that. There are some additional cases which also trigger the function. My site does not work with any of these along with the errors mentioned above.
If there a fix to this? If so, what can I do? I have looked around to fixes but I only get fixes where it prompts the user on whether they want to leave the page or not, I do not want that.
Additionally, I tried adding the function call to onclick on my external links but that is not being triggered on Firefox. I am guessing this is due to the amount of time onbeforeunload has before it is cancelled. If so, there a way around this?
Lastly, if this is not possible with onbeforeunload, what are my other options without prompting the user if they want to leave or not.
Thanks in advance!
EDIT: Here is some code that can be used:
https://jsfiddle.net/985drboy/
Make sure, that your code sending the message to the server is blocking and not async. If onbeforeunload returns before your message is sent, you get undefined behavior e.g. your message might not be sent if the page is unloads before the sending was complete. The browser continues unloading as soon as unbeforeunload returns.

Ways to notify/alert the user in Firefox's WebExtensions

I'm developing cross-browser extension using WebExtensions API. It's focused on monitoring some HTTP request and blocking potentially malicious ones. I need to get user input for each blocked host (because it could have been falsely blocked and user might want to unblock it right away). Originally I wanted to use popup, but then I found out, that popups are only allowed to be thrown up in User Action event handler, which is a problem, I need to to that independently on the user's action. After that I found second option - the Chrome's notification API. But again, found out, that Firefox does not implement buttons in notifitacions (even though Chrome does). OnClicked event is supported for notification, but that's not enough (mainly because of users accidentally clicking on the notification to close it).
TL;DR - Looking for a way to alert/notify user and get the input from him by clicking on one of two presented buttons. Popups and Notifications does not seem like sufficient way.
Can you suggest ways to implement desired behaviour?
Possible solutions:
1) Injecting content script that implements popup window and communicates via messages with bacgkround script.
2) Simulating animation of extension's icon to draw user's attention.

Resend Http Request via JS

I am currently trying to manually develop an unsaved changes warning in our JSF-based Webapplication. Sadly our customer does not like the styling of the default warning displayed via an alert() after using the onbeforeunload event and requires us to develop a similar mechanism on our own.
I was thinking of using the way described here to prevent the onbeforeunload event from displaying the alert() and simply showing my own modal panel. I just can't figure out how to make the "Yes" (yes, I want to leave this page and lose all unsaved changes) button work. The button should basically resend the request which lead to the onbeforeunload event which could have been a HTTP Request as well as an Ajax Request. How would one do that via JS?
Thank you :)
Cheers
//edit: It needs to work in IE9 as well as Chrome 38

Is there anyway to intercept javascript calls made by a web application

Is there anyway to inject JavaScript so that I can tell every time JavaScript is executed in the web page?
For instance suppose a button triggers some function foo("bar") ... I would like to inject JavaScript such that when a user clicks the button another function is called first and passed the function name "foo" and arguments "bar".
The reason I want to do this is that I'm trying to mirror one users actions to another remote user -- so that as one user clicks I could intercept the JavaScript function send it over via node.js to the other user and execute the same function on the second users side programatically.
load the webpage in google chrome
open the developer tools (either via the wrench menu or with shift+ctrl+j)
activate the Scripts tab
click the little 'pause' symbol to the right of the page
Now, as soon as any javascript gets executed, chrome will show you the code and wait for your instructions.

Categories