This object is in archive! 

Open local html file from link in popup

Paulo shared this idea 8 years ago
Completed

I have created mbtiles maps. When clicking on the map a popup is shown with a link to a html pages. For now this links to an online html page, but I would like to create links to html files on the device.

Suppose I have the file in a sub-folder 'docs' in the Locus/maps folder. I then tried to use a link like <a href="">mylink</a>, but I get the error "Unable to find application to perform this action"

Any idea how to do this?

Replies (14)

photo
1

Good day Paulo,


I've changed your "question" to "idea". Because I think this won't work automatically, but it will need some changes in Locus. May you prepare for me some sample map + html files, I may use for testing? Cannot promise it will work, but i should at least try it ...

photo
1

Hi Menion


Thanks for looking into this. Attached a zip file with mbtiles map. Clicking on the map will open a popup with a link. This link is of the form <a href="file:///docs/A.html">link</a>. The A.html and other html files to which the map links are in the folder docs that is also included in the zip file. Hope this makes sense


Paulo

photo
1

By the way, my question seems somewhat similar to this one? http://help.locusmap.eu/topic/how-to-open-a-link-in-a-browser. Although in that case is is about links in gpx files.


Forget the remark, this is about external web links.. not offline html pages

photo
1

it works (see clip)

but it can't be exported.

example.

- copy your (eg) test.htm to ../Locus/data/import/

- create point

- open/edit POI description:

  1. <a href="test.htm">TESTLINK</a>

photo
1

Hi Gynta, thanks! Unfortunately it doesn't work for me. The difference is that you are using waypoints, while in my case the link comes from a UTFgrid / mbtiles.


Menion, in the example I sent earlier, I used target="_blank" in the link. In that case, if I click the link in the popup (e.g., see figure1.png), I get the warning "Unable to find application to perform this action" (see figure2.png, warning in Dutch).


However, when I do not use target="_blank" in the link, and I click the link in the popup, the popup stays, the title of the popup remains the same, but the text disappears, see figure3.png.

photo
1

it works for you with waypoint popup?

photo
1

Hmm I have quite serious problems to make this work. Because you need to click on link in some loaded text and meanwhile change this link from relative to absolute path.


...


oki an hour later I found some working solution. Link open page in default web browser, not directly in Locus. So you will see in a next version how it works. Btw. nice system with external pages!

photo
1

This is great, looking forwards to the new version!

photo
1

seems, it works with last beta...

photo
1

This works great in the latest update, thanks Menion. I am working on a number of maps that implement this new feature. I'll post a link when ready.

photo
1

Perfect, glad to hear it!

photo
1

Hi Menion, I see you took it a step further, with an internal viewer for html pages (and pdf I read, or is that something else?).... absolutely brilliant. Didn't test yet if this works with online files, will do that tomorrow, but wanted to give a big thumbs up for this new feature in 3.9.1!

photo
1

Hmm to be true, I'm not aware of any new change in 3.9.1 related to this topic. But thanks ;).

photo
1

That is interesting. Before yesterday a link would open in my web browser (Well, I have two browsers, so I got the choice which one to use first). Now when clicking a link it opens directly in a window that "floats" on top of Locus with as only window decoration the cross button to close (see attached). Not sure what else changed on my mobile, but it is a great improvement in any case :-)

photo
1

it really looks like Locus window. Nice :)

photo
1

That screenshot was from my tablet. Just tested it on my phone, same. Are you sure you didn't do this ;-) ? Out of curiosity, does the same happen when you open a link (using e.g., links of one of my maps)?

photo
1

I'm constantly improving everything and I also try to reuse as much code as possible. So it is possible, that updates on one place changed behavior of this feature. I should find this reason,, but I thunk it is not important now.

photo
1

Hi Menion, tested it now with offline map (example) and unfortunately it doesn't work (anymore). Before I could choose to open the page in Firefox, Chrome or the stock browser, but now I can only open the link to the local html file in Firefox.


I read that Chrome and the stock browser seem to have some security measure disabling one to open local files. But on my tablet (Android 4.2.1) I can copy the link to the Chrome browser and it will open it. Doing the same on my phone will give me an "access to the file was denied", which is perhaps because on my phone I have the Locus data files on my sd card?

photo
1

Hmm I'm checking all possibilities and thanks to this topic http://stackoverflow.com/questions/17818230/android-view-local-html-file-not-showing-all-browsers , it looks that it is not as easy as it should be. Every web browsers seems to use own method.


Anyway I've installed few main browsers and seems that all except Chrome works fine. Chrome do a troubles not just here, so it is not a surprise.


Fact that you have data on SD card should not be a problem as html files are read-only. I think ... problem in Chrome, again :).


Anyway try next version, it should be better. Anyway I do not still understand, why Locus opened links in own private window. This won't be anyway working in next version.

photo
1

Hi Menion, thanks all this. Looking forward to the next version. My colleage has a workshop coming up where he will be showing our use of the maps on Locus, so perhaps we'll soon have a number of extra testers :-)

photo
1

I am looking forward to seeing the offline pages working as well. I do really like the way the online pages now look to be integrated into Locus - very cool!

photo
1

Ah so only online links are opened in Locus internal dialog? Ah, then it make sense for me. I've missed this information, sorry.


Hmm I was thinking about it, anyway it has also some disadvantages. Limited zooming, limited forward/backward. Display of pages in Locus is just ... limited. And in your case here it is not a problem, but I'm sure that there should be links to pages, where this may be a problem. So I really prefer open in external browser, rather then directly in Locus.

photo
1

Hi Menion, yes, only in online links. I wasn't too clear about that, sorry.


I also though the internal html viewer looked great. However, as pointed out by a colleague, in my html pages there are links to other websites that do not look good in the Locus html viewer.


So I guess you are right that an external browser is a safer solution. Or a combination of the two, perhaps the html page itself being opened in internal viewer, with a button to open in external browser, and/or further links to other websites being opened automatically in an external browser...


Anyway, just thinking out loud.. I think you are right that if it is one or the other, the preferable solution would be to have the links open in an external browser.

photo
1

I think we should keep it simple for now, so only external browser.


After some months of usage, it will be clear if should be better to use simple internal viewer or not.

photo
1

Hi Menion, just updated to the latest version. All works great, except that offline links are still not opening in Chrome (nor on the default browser of my Samsung tablet).


For those that do not have a compatible browser (like Firefox), it does offer to use the html viewer (at least, it does for me on my tablet and phone), but that doesn't display all pages well unfortunately.

photo
1

Hmm you have updated to 3.9.3 version? Just to be sure ...


Damn, this is weird. I'm just testing it on my Nexus 7 tablet and there is Chrome in list of offered browsers. Also do you have latest version of Chrome?


Hard to say how to solve it...

photo
1

Yep, just downloaded 3.9.3 and Chrome is also the latest version.


In the attached screenshot1.png I clicked a 'local link', i.e., a link to a local html page

In the attached screenshot2.png I clicked an 'external link', i.e., website link


Just to be sure it is not anything to do with a difference in map, etc. I tested it with the 'Uganda offline' map (you'll need to scroll down a bit).

photo
1

Ah thanks, testing and you are right.


Uff hard work ... so I've tested it a little more and found that it is really some weird system of Android. After some time, I found this app


https://play.google.com/store/apps/details?id=ru.gelin.android.browser.open


which is also open sourced. So I've checked this app and found, that it really just search for existing web browsers in device and then force them to open required file. This all because some browsers (like these from Google) aren't able to correctly handle request on file from disk.


------


I firstly wanted to forward you just to this application (because it is core of Android - every app do it's specific task), but then I realized that such extra work is really bad for end-user experience. So after another hour of work ... well, it's there :). So another version in next version. It looks to be loooong task, sorry for that.

photo
1

Thanks Menion. I had seen that app and tried it out, and it works fine. But as you said, not the perfect solution perhaps (it sometimes is really hard to convince people to install various apps to accomplish one specific goal). So I am really happy you spend the time to look for a solution, great and looking forward to the next version :-)

photo
1

This is now working perfectly, kudus!

photo
1

You are fast. Glad to hear it!

photo
1

Not sure this is of the update of Locus (the latest small bug-fix update) or because I updated the maps.. but I am back to Chrome not opening the html files. When clicking a link, I get the selection menu to select the browser (so far so good). However, when selecting Chrome, I am getting the same message about access to the file being denied. Firefox opens the html file without problem.


In case you want to test, download links of the maps + html files are on http://vegetationmap4africa.org/2_Vegetation_map/Mobile_maps.html - scroll down to "Download maps + factsheets for Locus map viewer"

photo
1

OK, it actually works on my tablet (Android 4.4.2), but not on my phone (Android 5.1), so I guess that is where the problem is?

photo
1

Testing:

"Lake victoria trasitional rain forest" - tak link leads to:

"file:///factsheets/Burundi/Ff.html" , Locus then tries to open "file:///storage/emulated/0/Locus/maps/MBT/factsheets/Burundi/Ff.html"


file:///factsheets/Burundi/Be-We.html , Locus then tries to open "/storage/emulated/0/Locus/maps/MBT/factsheets/Burundi/Be-We.html" , but no such files exists, sorry.

photo
1

You are right about the second link, my bad.. thanks for spotting it, I'll correct that one.


Does the first link work for you in Chrome on Android 5.1?

photo
1

Yep, I have no problem on 5.1 device and latest Chrome. If file really exists on correct place, it should work.

photo
1

Puzzling... I downloaded the same file and it works on my tablet on all browsers, on my phone it works in Firefox, but not in Chrome.


Given that it works for you, I guess the file is correct (apart from those missing html pages, which I am adding right now). Any idea what else I can/should check?


Perhaps it is because on my phone I have Locus root directory and map files on my external SD card (in /storage/sdcard1/android/data/menion.android.locus.pro/files/locus/maps)?

photo
1

OK, I know where the problem lies. I made a fresh install of Locus after removing all settings / files.

  • It works if Locus is installed with default settings
  • It does not work when in Settings - Miscellaneous - default directories the Root directory is set to /storage/sdcard1/Android/data/menion.android.locus.pro/files

photo
1

Hi,


I've moved Locus dir with map to private directory as you did and well, it works.


What URL do you see in Chrome? Is same as you see in Firefox?

photo
1

Yes, same URL:


file:///storage/sdcard1/Android/data/menion.android.locus.pro/files/Locus/maps/burundi_ol_v2_0/factsheets/Burundi/Ff.html


Works in Firefox, but not in Chrome

photo
1

Hmm then I'm worried that I cannot help here. If URL is valid (and probably is, because otherwise Locus do not convert it from relative to absolute - like in previous case with "Be-We.html" file), then it is just on web browser if it opens mentioned URL or not. And based on todays discussion, it is not the only problem of Chrome: http://help.locusmap.eu/topic/locus-pro-stuck-as-default-app-for-pdfs

photo
1

Yes, this issue with Chrome is quite annoying. I would guess it is related to this build in security provision of Chrome

that prevents it from loading HTML files that are stored on an external

SD card. But then why would you be able to open it in Chrome? Anyway, as you said, this is more of a problem of Chrome than Locus. Thanks for all efforts!

photo
1

Ah you mean it is "local file from card" problem?


Hmm. I have tried private directory in internal memory, so only something like "file:///storage/sdcard0/Android/data/menion.android.locus.pro/...". My tablet do not have SD card and I though it is only a problem of generating valid link to file.


Well, understand it is little bit stupid (generally as whole change in access to SD card on Android), but I have no idea, how may I help here. It is on 90% really only a problem in Chrome.

photo
1

Yes, if the map + html files are installed on internal memory, I have not problem either.


To further illustrate that this is indeed a Chrome problem. If I click on those same html files in my ES file browsers, Chrome is not offered as an option (like used to be the case for Locus).


Wish there was more consistency between programs.. with Firefox not supporting Quick-install, Chrome not supporting html files.


Anyway, thanks again for the efforts.

photo
1

You are welcome.


For "quick-install" exists two methods. One works for some browser, one for another, crazy. We plan anyway during next days, spend some time on this and try to create some united system. So hope at least one problem less ...

photo
1

Thanks, that would be great.


For now I have just added a small trouble shooting section to my website: http://vegetationmap4africa.org/4_Documentation/Tutorials/Install_in_Locus.html#trouble_shooting

Replies have been locked on this page!