3

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.

Rakesh Pai
  • 26,069
  • 3
  • 25
  • 31

0 Answers0