Detect if browser supports local mDNS querying - javascript

It appears that some browsers support querying for local mDNS addresses (of the type http://hostname.local/), while others don't.
It looks like iOS supports this in it's networking stack itself, so all browsers on iOS support .local addresses. On Android, it appears that all DNS queries are sent to Google's overlord servers, so .local addresses are just not possible to resolve. However, Firefox on Android for example implements it's own DNS querying for .local type addresses, so there are at least some Android browsers that support .local addresses. As far as I can tell, on the desktop, mDNS support depends on the OS. Mac supports mDNS out of the box, while Windows and Linux support it if Bonjour/Avahi is installed.
My web app runs as a single-page-app served from a static server on a local intranet, and I need to communicate directly with other servers in the network using CORS (no proxy). To be able to locate and address the servers, considering that DHCP might not assign them a static IP, I need to know if mDNS querying is supported in the user's browser, and fail gracefully if it isn't.
How can I feature-detect, in client-side Javascript, if mDNS is supported in the user's browser? I don't mind if the solution is a little hacky, if it solves the problem.

Related

How to work around lack WebRTC support in a browser?

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.

Turn off the https requirement for https gated web APIs in Chrome and Firefox

Many modern Web APIs are gated by the browser to be HTTPS only. This is good for users but can make developing painful. During development I'd like to be able to turn off that requirement just for testing.
Is there a flag I can set (about:config in firefox, about:flags in chrome) or a command line parameter I can pass in to turn off that requirement so I can test without having to setup https certs and add them to the browser?
Note: I understand the https requirement is dropped for localhost but I'm often hosting on one machine (like a laptop) and testing on another (like an Android device) or a different desktop. I know I can generate a local cert and run a server that supports https. I then have to deal with security warnings on the browsers (invalid cert) and/or add the private certs to all the devices OR I have to register a domain solely for the purpose of getting a valid cert via letsencrypt. For my own dev I'd just like to temporarily turn off that check in the browser if possible. Of course what I actually serve to users will be https but during dev if I could turn off that requirement things would be so much easier.
In my particular case I'm trying to use WebXR so dev happens on my laptop but actual testing happens on an Android device where the page is served from my laptop.
One solution suggested here is to use Chrome's port forwarding
https://developers.google.com/web/tools/chrome-devtools/remote-debugging/local-server
That works for Chrome desktop to Android
On your desktop you tell desktop chrome what site at what port to forward to your android device at another port. That site can be a server on the internet or a server running locally on your desktop. On the android device you can then access that site at http://localhost:<port-you-specified>. https requirements are dropped for locahost host so you can now use the APIs that were restricted otherwise.
Chrome has a developer setting Insecure origins treated as secure in chrome://flags/, this is a text field where you can add a list of origins treated as secure for development purposes. (Via https://github.com/immersive-web/webxr/issues/60)

Getting a mac address from a device via web script or http

Is it possible, considering I have access to all of the end user devices to allow security exceptions, to request the device mac address using any web scripting process running in Apache/IIS/Nginx? PHP? Perl? ASP?
Client devices are running iOS so this won't work http://www.qualitycodes.com/tutorial.php?articleid=19&title=MAC-Address-Using-WMI-on-Internet-Explorer
It must be possible because MDM solutions get it through a Config Profile...
In a word: no.
Actually, using the standard protocols/technologies you mentioned above it is not possible to retrieve the MAC address of the client.
What is possible is using a legacy technique where you install a "native" software on the client machine (e.g. activeX, java applet...).
That software, once installed, can retrieve easily the MAC of the client's device. Thus, it could call your web server with the MAC as an argument.
Nothing of the scenario above is expected to be implemented or is already implemented.

Chrome web notifications without SSL (bypassing Service Worker)

So, is it possible to implement web notifications for Chrome without SSL certificate?
I want to avoid installing SSL on my site and it would be cool if there was a way to send notifications without Service Worker.
You can still use the (old) Notification(title, options) constructor and it’ll work on some (desktop) platforms. But (as I guess you know), it doesn’t work in Chrome for Mobile (Android).
What does work on Chrome for Mobile is the ServiceWorker-based showNotification(title, options) approach. But per the Service Workers spec, you can only use Service Workers in secure contexts (in order to protect users from the risks associated with insecure contexts).
So if you want something that will work for Chrome for Mobile users, then the answer is, No, it’s not possible to use Web Notifications in Chrome for Mobile without Service Workers (and so also, without deploying an SSL certificate for your site).

web application development with j2me

The main reason I'd like to use j2me is that one of its main advantages is that it can access the phone's resources through its various APIs. However, due to newer phones having web browsers like Safari, Opera, and Windows IE, it would be advantageous to build a web application so a user wouldn't have to download some software onto their phone. Is there a way I could build a web application that can also acquire resource information about the phone? Or maybe have j2me converted to Javascript (if that's even possible)?
You can make a link that would send an SMS, but other than that, there's no cross-platform api for accessing phone internals from browser, as far as I know.
So, if you've got to access phone's resources, you'll have to write a real app.
The webkit engine on recent Series60 phones has been given access to at least some phone resources.
Nokai calls it Web Runtime or WRT.
http://www.forum.nokia.com/Resources_and_Information/Documentation/

Categories