how to use app.HttpRequest()

118 views
Skip to first unread message

wrivhov wrivhov

unread,
Feb 17, 2016, 5:43:22 AM2/17/16
to DroidScript
excuse me, how to use app.HttpRequest() ?
and does this can change referer and user-agent ?

Dave Smart

unread,
Feb 17, 2016, 6:17:15 AM2/17/16
to DroidScript
You can use the normal XMLHttpRequest object as if you are in a regular browser instead if you like.

But if you need to use the app.HttpRequest() method for some reason (for example you have CORS issues) then this is an example of how you use it:-

app.HttpRequest( "get", "http://maps.googleapis.com", "/maps/api/directions/json", 
        "origin=Toronto|destination=Montreal|avoid=highways|mode=bicycling", 
        OnHttpResult );


There is an extra 'headers' parameter which is not included in the above example, but you should be able to use that to set your user agent etc by setting that parameter to something like this:-

"User-Agent=MySuperUserAgent|Referer=http://www.google.com"




Reply all
Reply to author
Forward
0 new messages