Some browsers (mobile Mi Browser, for instance) don't support WebRTC - they have no RTCPeerConnection API. So the users of your WebRTC web app have to open it in another one.
Is there a way to make your WebRTC app work without an explicit browser-change action from the user, especially on a mobile device?
I tried to investigate the following:
Deep Link. Looks like we can't redirect the user to another browser using deep link (I haven't found Chrome deep link for mobile).
Send WebRTC sources to browser / use third-party WebRTC lib. This won't work either, you need WebRTC support in the browser source code.
WebRTC is a framework based on a set of standards. It includes not only capability to get information about user input/output devices, but also set of network protocols which based on UDP (from getting client's IP to transfer arbitrary data through data channel using SCTP protocol). So, as you already may guess, it's impossible to support in a browser which doesn't have it, this is why point (2) will not work.
In case of point (1 - Open Chrome). On iOS exists custom protocol to open URL in chrome "googlechromes://stackoverflow.com", but it's better to explicitly say user that current browser doesn't support required functionality; And provide links on list of popular browsers for download (Chrome, Firefox, etc.); And already on these websites user will be redirected to the proper store for downloading native app.
Related
Is it possible to stream the Desktop Information using webrtc in a webapplication. Would an application like that be a security issue if that is possible, currently we built an application which can stream using the Webcam with webrtc. But I have no real idea of how to stream the actual Desktop of the Computer to someone, I only know of native application like Skype or TeamViewer which can do something like this, but a webapplication?
Yes it's possible. To stream the user's desktop instead of their camera, replace
const stream = await navigator.mediaDevices.getUserMedia({video: true});
with
const stream = await navigator.mediaDevices.getDisplayMedia({video: true});
This will prompt the user to share an application window or desktop surface of their choice.
Note that browser support is limited at the moment. getDisplayMedia is implemented in Chrome 72, Firefox 66, Edge 17, and behind a flag in Safari 11.
It is also available using the adapter.js polyfill on older versions of Firefox and Chrome, though this requires installing a web extension in Chrome.
Would an application like that be a security issue
Yes, there are significant security issues related to screen sharing.
The obvious risk of letting a web site record your desktop is it may reveal private information.
A nonobvious risk is that sharing your browser or the entire desktop when your browser is visible on it, is dangerous, and should only be done with sites you trust.
This is because a malicious web site present on such web surfaces may effectively browse on your behalf and record the results, circumventing important cross-origin protections in the browser.
Is there a way to make a browser aware of iBeacon devices in its proximity?
Similar to the way HTML5 Geolocation is working...
If not would this be something that can be achieved with a browser plug-in that can provide the detail to be consumed by javascript?
Unfortunately, no. No web browsers have implemented any bridges between beacon detection and JavaScript.
I don't think a plugin approach is possible on mobile browsers (either iOS or Android), because neither browser supports asynchronous communication between external apps and JavaScript in Mobile Safari / Mobile Chrome. The best you could do is have a custom app that responds to a beacon, then launches a web page in the browser. But I realize that isn't what you are asking for.
If you want to build a native app with JavaScript, you can use Cordova (aka PhoneGap) and use plugins that provide beacon support. My company has one for our ProximityKit beacon framework:
https://github.com/RadiusNetworks/proximitykit-plugin-cordova
There is also a Cordova plugin that has basic beacon support here:
https://github.com/petermetz/cordova-plugin-ibeacon
This looks promising (2016), Google Chrome developers site showing a desktop browser feature as a work in progress.
https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web?hl=en
Even though the Web Bluetooth API specification is not finalized yet,
the Chrome Team is actively looking for enthusiastic developers (I
mean you) to try out this work-in-progress API and give feedback on
the spec and feedback on the implementation.
Web Bluetooth API is currently available to be enabled experimentally
on your origin in Origin Trials, or locally on your machine using an
experimental flag. The implementation is partially complete and
currently available on Chrome OS, Chrome for Android M, Linux, and
Mac.
Go to chrome://flags/#enable-web-bluetooth, enable the highlighted
flag, restart Chrome and you should be able to scan for and connect to
nearby Bluetooth devices, read/write Bluetooth characteristics,
receive GATT Notifications and know when a Bluetooth device gets
disconnected.
https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md
There's a W3C specification for this Web Bluetooth, but there's no support yet: http://caniuse.com/#search=bluetooth.
If you decide to write a Phonegap plugin implementing this spec will be a good starting point.
I am in Windows Server 2012. I uploaded a site that works fine in my laptop, but has problems when I test it on the server's IE 11.0.9600.16384.
I have this code to insert html5 videos in the site
document.getElementById("videogal").innerHTML=' ';
elemv.src=mplv[0];
document.getElementById("videogal").appendChild(elemv);
videogal is a div
elemv is a global var:
var elemv = document.createElement("video");
mplv is an array that contains literals, such as "myFolder/myvideo.mp4".
As I said, it works fine in my laptop, but not in server's IE. IE's console says Not Implemented and marks this line elemv.src=mplv[0];
I dont know how to handle that. I alert the mplv[0] and has the proper value.
Most important: will this bug appear in client's browsers also? Or is just locally on server. I connect to the server as Admin and have turned off all the security restrictions of the IE.
Windows Server does not by default include certain "desktop" functionality, which includes the ability to play HTML5 video in Internet Explorer. Typically you wouldn't want users using server resources to play video. The "Desktop Experience" feature can be installed to add that functionality.
Installing this has no bearing on another machine's ability to play video served from this server. Other browsers (e.g. Chrome) running on the server have their own capability to play video and are unaffected by this feature being installed or not.
I'm planning to make a login system by USB, so if you put in a USB-drive and open a specific webpage, the website asks the USB-drive for the code (e.g. by a JavaScript file, a redirect or something like that).
The problem is, because of sandboxing, you can't load or redirect to local files. I don't know a solution for this problem. Can you guys help me? I don't need specific code, just an example or something in that way.
Maybe you can read up on USB-HID. Wikipedia:
The USB human interface device class (USB HID class) is a part of the USB specification for computer peripherals: it specifies a device class (a type of computer hardware) for human interface devices such as keyboards, mice, game controllers and alphanumeric display devices.
Here are some references:
USB HID (Human Interface Device)
node-hid - Access USB HID devices from node.js
DepthJS: 'Allows any web page to interact with the Microsoft Kinect using Javascript'.
A related Stackoverflow question:
Write data to USB HID using Javascript, HTML5, or any cross platform language (supports Android)
One other possibility is to check out the Chrome HID (Human Interface Device) APIs:
Interacting with USB HID devices from web apps – via Chrome Apps, see below
Relevant Chrome API docs
Please note that for the time being, you cannot interact directly with the USB device (i.e. you cannot access any WebAPI offering that kind of fine-grained control).
Building a Chrome App (different from a Chrome Extension) may help; This article may point you in the right direction, since it also provides sample code.
The only way I can think of is putting a html file on the usb stick that essentially generates some sort of login token and gives you a link or a form to a login processor. You can then access the webpage by opening the local file first which will redirect you to the actual webpage.
This local script may include a javascript from the server to get some challenge-response-data which it hashes somehow (perhaps in combination with a password) and puts it into the form data.
Web PKI authentication from Modern Browsers may be achieved by using Browser Extension. One such extension is Signer.Digital browser extension. Use below Javascript promises from the APIs provided by Signer.Digital extension.
SignerDigital.getSelectedCertificate() to register user's certificate
SignerDigital.signHash(hash) to sign token at browser and verify at server
For all Javascript APIs refer to SO Answer https://stackoverflow.com/a/63173083/9659885
Disclaimer : I work for a company supporting the application below
Hello, you may try to use Nexu open-source application for communication with smartcards or USB tokens. It also support PKCS 12 keystores.
For example, the application is connected to the DSS webpage on the website of European Commission : see the link.
I've written an UI in HTML5 and JavaScript. I chose this implementation so that I could share the same code between both Android Chrome and Windows 8 RT.
Now, my next objective is to write data to a USB HID. The device that I'm communicating with is treated as an HID. I'm mentioning this part in case there's a way to write to an HID device rather than a USB RAW device.
I've done a lot of research on the matter. But, the HTML5 specifications are changing so often that maybe I missed something.
**Anyway, is there a language or implementation that I can use to share common code to access a USB device on Android and Windows 8 RT?
If there isn't a way to share between the two, how about a suggestion to get USB communication only on Android?**
Below is my research along with conclusions:
Silverlight: unsupported. In terms of web plugins, it is not supported on Windows 8 RT or Android
Flash: Possible option. It is supported in both operating systems, although they removed support for Android with release of Android 4.1 (Jelly Bean).
HTML5: unsupported
I looked at the GamePad API, but it seems to only support reading from a gamepad.
I looked at Device tag, but this tag no longer exists in the current draft. I read that the "navigator" object replaces it in JavaScript, but it seems completely different. Also, Device only targets acquiring video and audio
JavaScript: unsupported. From my understanding, this is because it'd be a security risk.
Chrome Packaged App: unsupported. I am unsure about support in Windows 8 RT. But, it is not supported in Android Chrome, either.
A USB API exists that accomplishes exactly what I need, but the API is only available to a packaged app.
Java applet: unsupported. I am unsure about support in Windows 8 RT. But, it is not supported in Android Chrome, either.
There are many resources available regarding how to communicate with USB devices. However, since Java applets aren't supported on smartphones, this ends up being unsupported.
A couple of useful posts
How can I send and receive data to a serial port or USB port in ASP.NET?
Is accessing USB from a web application for cross browser cross OS possible at all?
Is that possible to provide a JavaScript API to control USB, LPT, and COM devices?
I've actually thought about how to do things similar to this...
Here's is one way sure way to do it if you have control over the computer which has the USB device attached:
Have the computer with the USB device run a web server such as Apache and PHP. Have it only listen to localhost.
Then in the HTML page being viewed, execute an Ajax post to localhost/somescript.php (or CGI or cfm or whatever).
In the PHP/CGI script, communicate to the USB device and then return a JSON string to the browser saying something happened.
Another approach is to use custom URL protocols. You create an executable and "install" it on the client computer along with your custom URL protocol.
Then you can invoke the executable from the browser using your custom URL protocol.
There is one more alternative Web Socket.Create a web socket server which will access the usb device in local system.
Connect your web server using Web Socket from Web Application.Web Socket has standard Api
You can do something like this
var host = "wss://localhost:25000/test";
Websokcet ws = new WebSocket(host);
You can create your web sokcet Server using RFC 6455
for older browser you can think of http server as well.
Please have a look at JSFS. It works similar to Chris_vr's approach and is already a working solution.
https://github.com/jsfsproject/jsfs.
It's free and licensed under GPL.
If the USB device you want to control is a barcode printer, you can use jZebra.
This is an applet which directly communicates to locally connected printers.
Writing to a serial port:
var writeSerial = function(str) {
chrome.serial.write(connectionId, str2ab(str), onWrite);
}
// Convert string to ArrayBuffer
var str2ab = function(str) {
var buf = new ArrayBuffer(str.length);
var bufView = new Uint8Array(buf);
for (var i=0; i<str.length; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
More is at http://developer.chrome.com/apps/app_hardware.html.