← Back to team overview

ubuntu-phone team mailing list archive

Re: Default browser behavior

 

On Tue, Oct 21, 2014 at 4:57 PM, Olivier Tilloy
<olivier.tilloy@xxxxxxxxxxxxx> wrote:
> On Tue, Oct 21, 2014 at 4:07 PM, Mitchell Reese
> <dev@xxxxxxxxxxxxxxxxxxxxx> wrote:
>> On Tuesday, 21 October 2014 11:29:21 PM AEDT, Olivier Tilloy wrote:
>>>
>>> On Mon, Oct 20, 2014 at 6:13 PM, Mitchell Reese
>>> <dev@xxxxxxxxxxxxxxxxxxxxx> wrote:
>>>>
>>>>
>>>>> On Mon, Oct 20, 2014 at 4:29 PM, Mitchell Reese
>>>>> <dev@xxxxxxxxxxxxxxxxxxxxx> wrote:
>>>>>>
>>>>>>
>>>>>> Is there any easy way to hack the browser so it use a different search
>>>>>> engine? I use google as little as possible. Am also keen to change the
>>>>>> default page of my own setup.
>>>>>>
>>>>>> Happy at having a go if someone can point me in the right direction.
>>>>>
>>>>>
>>>>> You won’t need to hack anything :)
>>>>> The browser app already supports a couple of configurable settings,
>>>>> even though it doesn’t have a UI for them yet. It’s all explained in
>>>>> the README file in the source code:
>>>>>
>>>>>
>>>>> http://bazaar.launchpad.net/~phablet-team/webbrowser-app/trunk/view/head:/README#L71.
>>>>>
>>>>> Cheers,
>>>>>
>>>>>   Olivier
>>>>
>>>>
>>>> Have got it partly working. Have created
>>>> ~/.config/webbrowser-app/settings.conf and added:
>>>>
>>>> homepage=https://duckduckgo.com
>>>> searchengine=duck
>>>>
>>>> Homepage works on initial startup, however due to the bowser always
>>>> 'remembering' the previous site browsed, this is almost never seen.
>>>
>>>
>>> Indeed. If you run the browser from the command-line with the
>>> "--new-session" parameter, it will forget about previously open tabs
>>> and it will default to the homepage again.
>>>
>>> Changing
>>>>
>>>> the default search engine is more problematic. Following this advice in
>>>> the
>>>> link above:
>>>>
>>>>  -  'searchengine':  a  custom  search  engine  specification,  looked
>>>> up
>>>> in
>>>>    $HOME/.local/share/webbrowser-app/searchengines/{value}.xml  and
>>>> following
>>>>    the  OpenSearch  document  description  format
>>>>    (http://www.opensearch.org/Specifications/OpenSearch/1.1)
>>>>
>>>>
>>>> I added a ~/.local/share/webbrowser-app/searchengines/duck.xml file, and
>>>> filled it with:
>>>>
>>>>  <?xml version="1.0" encoding="UTF-8"?>
>>>>  <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/";>
>>>>    <ShortName>Duck Search</ShortName>
>>>>    <Description>Search Duck Duck Go</Description>
>>>>    <Url type="text/html"
>>>>         template="https://duckduckgo.com/?q={searchTerms}"/>
>>>>    <AdultContent>false</AdultContent>
>>>>    <Language>en-au</Language>
>>>>    <OutputEncoding>UTF-8</OutputEncoding>
>>>>    <InputEncoding>UTF-8</InputEncoding>
>>>>  </OpenSearchDescription>
>>>>
>>>> Still defaulting to google search. What am I doing wrong?
>>>
>>>
>>> I just tested on my krillin with this exact content, and search is
>>> performed by DuckDuckGo. Did you restart the browser after creating
>>> those files?
>>>
>>
>> Yep, restarted browser after changing those files, and have since rebooted
>> phone several times. Still defaulting to google search on mako.
>>
>> Is it possible there's something different with your setup?
>
> I can’t think of any setup-specific difference that would impact the
> functionality. It sounds like the only difference is that you’re
> testing on mako whereas I’m on krillin, but again that shouldn’t make
> any difference (that feature was introduced more than three months
> ago, at the time I was testing on flo).
>
> Can someone on this list try it out with Mitchell’s instructions on
> mako and see if it works for them?

Riccardo kindly helped me debug the issue with his nexus 4. It turns
out the parser for the XML file fails to read it if there is any
whitespace at the beginning of the file, before the "<?xml …>"
declaration. Whitespaces on other lines don’t seem to matter.


Follow ups

References