Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

How can I redirect URL to file location on 4.0.3?

For example, browser want to connect to foo.com but it redirected to file:///sdcard/foo.com/

It can't work through hosts, because it used for domains only, some people tell me about local proxy, but how?

share|improve this question
    
Via the hosts file you could redirect certain requests to a web server running locally on the device (you'd need to find and install one) which could potentially serve some form of index pages for folders on the device. You can't do much else if the browser doesn't support file:// URIs. The question I have is: Why do you want to do this? Using the browser for accessing files is going to be worse in most every way compared to an actual file explorer. –  Matthew Read Mar 26 '12 at 20:24
    
I want to do offline android documentation acces for Android IDE –  mishkapp Mar 26 '12 at 23:42
    
Oh, so actual HTML rather than arbitrary files? Yeah, that should be easy if you install a web server. I would expect you wouldn't need to edit hosts actually -- just use http://localhost/. –  Matthew Read Mar 27 '12 at 2:06
    
okay, i install web server working on 127.0.0.1:8080 but when i write "127.0.0.1 developer.android.com" i can't connect through URL –  mishkapp Mar 27 '12 at 13:10
    
That ... doesn't make sense. A local server needs to serve local files, if you were trying to access developer.android.com directly you wouldn't need anything local. If you install the Android SDK on your PC, you can grab the docs folder and put it on your device where the webserver can see it (or configure the server to point to wherever it is on the device). The URL you'll end up using depends on that configuration but it would probably be something like http://localhost/docs/index.html. –  Matthew Read Mar 27 '12 at 17:38
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.