frontend - Detect for Phonegap correctly

We can probably safely assume if it's Phonegap, it's running on
`file:///`. Maybe not perfect but good enough for now.
backend - Redirect to root unless url is passed as a query parameter

Looks like this old behavior might be needed on PhoneGap auth.