He
today i tried to browse a embedded device website that is ‘discoverable’ by zeroconf/avahi.
from my ubuntu system this is working fine. i can use the devicename.local style to get to the website.
i then tried the same from my android phone firefox browser - only to get a ‘server not found’ response.
first i thought i have missed something - but after some internet-research i found that it seems the android system does not handle these zeroconf things by default…
(https://groups.google.com/forum/#!topic/groundcomputing/5MYwcvN8wWY)
Android has a API to scan for available services (and-or broadcast a own service) - but it seems this is not used/implemented in current browser.
The API can be found at https://developer.android.com/training/connect-devices-wirelessly/nsd.html
So my Idea was to create a Firefox-Mobile Addon that just does make this url-form available to use.
this would be my first addon - so not the easiest thing but there is some motivation to learn all things needed!
But i first want to know if you guys think this is possible at all.
i have had a first quick look at the WebExtension documentation and found a interesting locking part that could be useful for this:
webRequest and specially webRequest.RequestFilter
as filter/match url i successfully tested as described
<scheme>://<host><path>
*://*.local/
test:
var match = new MatchPattern("*://*.local/*");
var uri = BrowserUtils.makeURI("http://myhostname.local/");
match.matches(uri);
// results in true
var uri = BrowserUtils.makeURI("http://myhostname/");
match.matches(uri);
// results in false
If i understand this correct i can do something like this: (pseudo code)
register eventhandler for onBeforeRequest (with match filter for *.local url)
--> handle request:
extract url zeroconf part
lookup if zeroconf service with name is reachable
rewrite url with direct ip
register eventhandler for onHeadersReceived for this request
--> handle headersReceived
change ip back to zeroconf name
would this work?
- that seems relative straight forward. only challenge would be to do the zeroconf discovery… (for this i don’t have searched yet… - but i think i can nott use the android build in api for this but would have to implement this myself in the extension.)
i hope you can give me some feedback on this idea.
sunny greetings stefan