Android Question Webview download problem

rboeck

Well-Known Member
Licensed User
Longtime User
I work on an app, where i use a website for route optimization (www.routexl.com) inside my app with webview.
I can transfer adresses inside the url string and let the user optimize his route. So far, so good.
The next step i want to try, is to get back the optimized route, i need primary the new sorted adresses.
Routexl has six export possibilities, which i can use on an desktop browser interactiv, but when i used it with http - httpjob, Job .Download etc. i get 'Direct access not allowed (DL)'.
Do i have any chance to better simulate an normal user? I already tried to accept cookies, but this didnt help.
 

sorex

Expert
Licensed User
Longtime User
they must be checking the http-referer to see if the request comes via their site.

you can fake that by sending an http-referer parameter that hold the url of the page where you hit the download button.
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Thanks for your help; currently i make it this way:
open the site with webview
in webview_OverideUrl i check the url parameter for the download link
then
B4X:
Dim Job as HttpJob
Job.Initialize("JobXl",Me)
Job.Download(url1)

Sub JobDone (Job as Httpjob)

if JobSuccess= True then
   Job.Getstring

her i get the string: 'Direct access not allowed'. I have only found possibilities, to add an referer for webview, but how can i handle it with httpjob?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
that won't work as the webview is bound to another session on the server.

you need to do it all via the download jobs.

try something like

B4X:
job.GetRequest.SetHeader("Referer", "http://thatsite/restofURL")

execute that right after the download
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
Can i recapitulate? Mixing of Webview and Http. Job download ist impossible. I cannot imagine, how to work all via download jobs, because i first need a bigger part of interaction in webview.
I tried the setheader line in my current code; the syntax was ok, but it didnt change anything.

I have an PHP Session Id, which i get with the cookie manager; it looks like: PHPSESSID=mq1sbebtanfer951do53mt7u21; __utmt=1; ... ... ...
could this help to connect the download job to the webview session?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I doubt it.

The session manager will see that it is a new session and it will generate a new session id and other things.

You can give it a try tho, maybe it works afterall.
 
Upvote 0
Top