← Back to team overview

ubuntu-phone team mailing list archive

Re: viewing local HTML files

 

On Mon, Mar 28, 2016 at 1:43 PM,  <kaabud-lp@xxxxxxxx> wrote:
>>>>  I have in the HOME of phablet some tree with HTML (...) files:
>
>>>>
>>>>  phablet@ubuntu-phablet:~$ ls -C1 diario2016/
>>>>  diario.html
>>>>  enanitos/
>>>>  imagenes/
>>>>
>>>>  (diario.html has <img ...> refernces into the subdirs enanitos/
>>>> and
>>>>  imagenes/).
>>>>
>>>>  How can I view this locally on the BQ? I tried something like:
>>>>
>>>>  ubuntu-app-launch webbrowser-app
>>>>  file:///home/phablet/diario2016/index.html
>>>>
>>>>  but with no luck.
>>>>
>>>
>>>
>>>  A .desktop file like this works for me:
>>>
>>>  [Desktop Entry]
>>>  Name=web container
>>>  Type=Application
>>>  Exec=webapp-container --enable-addressbar --enable-back-forward
>>>  --webappUrlPatterns=/home/phablet/* /home/phablet/
>>>  Terminal=false
>>>  X-Ubuntu-Touch=true
>>>
>>
>> Hello,
>>
>> Thanks, where should I place this file?
>>
>>      matthias
>>
>
>
> Oh, sorry, I was a bit too brief - I thought you had been down the route of handwritten .desktop's before.
>
> You put this in a new file here:
> ~/.local/share/application/
> e.g.,
>
> ~/.local/share/application/MyWebContainer.desktop
>
> For your purpose, I guess you will want to change the Exec= line into something like
> Exec=webapp-container --enable-addressbar --enable-back-forward --webappUrlPatterns=/home/phablet/diario2016/* /home/phablet/diario2016/index.html
>
>
> I can't fully remember where I did take the information about these parameters from, try a websearch. Or try leaving them out, the names are quite descriptive anyway.
>
>
> In the .desktop file might want to adjust the Name= and Icon= lines to your liking.
>
> Once you have saved that file you need to pull-down-to-refresh in the appscope and then a new launcher should show up.
>
>
> Also, note that I'm not claiming that you /can't/ get this to work with webbrowser-app, but simply, I had this webapp-container snippet lying around and I /know/ that this one works for me.
>
> Good luck, and let us know how it goes, or if somethings unclear.

Thanks for that useful tip!

I can confirm that browsing local HTML files won’t work in the browser.
This is an unfortunate side-effect of confining the browser with
apparmor to prevent disclosing sensitive information (previously the
browser ran unconfined and one could view the contents of all files on
the filesystem).

I’d like to find a middle-ground solution to that problem, so that
users could browse and view "legitimate" files in their home folder,
without compromising security. I’ve filed
https://launchpad.net/bugs/1563214 to track the issue. Suggestions and
ideas welcome.

Cheers,

 Olivier


Follow ups

References