How to Set User Agent in a Webapp on Ubuntu Touch

application-developmentubuntu-touchwebapps

I have developed a simple web application which is in the click store and available for users to install on their phone. Some websites require a special UA string in order to render correctly and I'd like to reluctantly do that in my webapp.

How do I override the UA in my webapp?

Best Answer

You have basically 2 ways to do this:

  • in your desktop file, update the Exec= line by adding --user-agent-string='Your UA' to it,
  • add a webapp-properties.json file in your webapp folder such as:

http://bazaar.launchpad.net/~dbarth/+junk/webbapp-whichbrowser/view/head:/webapp-properties.json

there is a small caveat here, you have to move your other command line definition (such as --webappUrlPatterns) in that file (in the "includes" section), and add --webappModelSearchPath=. or --local-webapp-manifest (which is a shortcut for the latter) to your Exec= line,

Related Question