Is it possible for JavaScript to detect whether an application (such as BitTorrent) is installed and if so, can it can be launched by clicking on a link?
This is not Javascript, it works with handlers.
Handlers are in your browser and trigger events when a special protocol is clicked / called.
e.g.: if you open a magnet:// link, it will trigger the handler for magnet. And the handler is connected with the bittorrent application.
So:
first question: No
second question: Yes (with a handler [need to be installed in browser])
Related
I have two apps, App1 and App2.
App2 is embedded as an iframe in App1, so App1 is parent app which embeds App2.
When user closes App1 from browser, I want to trigger an api in App2.
I tried using 'unload' event in App2, but that is not getting triggered when App2 closes (am checking by putting debugger point on event listener function, which gets called when standalone App2 gets closed).
Is there a way to accomplish this? Thanks
Historically trying to make asynchronous requests in unload events has never been reliable
For that reason navigator.sendBeacon(url, data) was created.
It works in the background even after page or tab is gone and helps solve a lot of the reliability problems of using unload events.
With the sendBeacon() method, the data is transmitted asynchronously when the User Agent has an opportunity to do so, without delaying unload or the next navigation.
I've never used it in the disappearing iframe scenario like yours but believe it would solve your issue
I have a device, which uses JSP to create the webpage, to maintain itself. There are some onclick events, and I would like to get some information from this device via a stand alone application, which only connects via IP to this device, and get all the information.
So, is it somehow possible to get directly to the functions, which are normally triggered via onclick events, so that non-human programs can open these pages?
Thank you
On a single page I've got two AngularJS apps (not controllers). Both of them watch for the $locationChangeSuccess event by using $scope.$on('$locationChangeSuccess', ...).
If I manually change the hash in the URL in the browser, event handlers for $locationChangeSuccess fire in both apps.
However, if one of the apps changes the hash by calling $location.search(...) only the $locationChangeSuccess event handler defined in that apps gets called. The event handler in the other app does not fire.
I've created a jsfiddle that shows the behaviour.
How do I get the other event handler to fire as well in this situation?
I'm developing a click-to-dial tool, and would like to pass all tel: links in firefox to my extension, which will then run click to dial
so
Call this customer
should silently be passed to my extension to deal with and not ask the user which external application they wish to launch
This is primarily for Mac users although it should ideally be a cross-platform solution (so handled within the JavaScript rather than using any external applications)
Any suggestions where to look/what to Google?
How protocol URLs are handled is something that's determined by the operating system. You can see more details in this article.
What you'll want to do is run a content script on each page to detect tel: links and register a click handler on them. This click handler could perform the action you want, then return false to prevent any further action being taken.
I solved this by writing and registering my own protocol handler
Mike's blog gives a helpful walkthrough
Mozillazine explains what you're doing
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.