Web Cookies

Post

Posted
Rating:
#1 (In Topic #1207)
Avatar
Guru
cogier is in the usergroup ‘Guru’
Does anybody know how to deal with web cookies. If I navigate to Google Maps and select 'Accept All' button, how do I prevent having to do this every time the program runs? I have attached a little program that will stop after you click the 'Accept All' button and the screen has finished displaying the map, but there are no cookies!

Attachment
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
hmm can't figure that one out m8, cookies seem to remain null.

But i figured out a bypass.

I tried to download the url using HttpClient.Download()  then the text i got was a page saying "Page moved to <url>" and clicking that url showed the page without the cookie request.
With this URL…
Google Maps

So i broke down the url to make the following function that you can pass the map coords to..

Code (gambas)

  1.  
  2. Public Sub Form_Load()
  3.  
  4.   WebView1.Url = GetMappAdress("50.6945657,-1.2873369,12z")
  5.  
  6.  
  7. Public Sub GetMappAdress(Address As String) As String
  8.  
  9.   Return "https://consent.google.com/ml?continue=https://www.google.com/maps/@" &
  10.   Address &
  11.   "&gl=GB&m=0&pc=m&uxe=eomtm&cm=2&hl=en&src=1"
  12.  
  13.  

That now loads the map and does not ask for cookie consent.

Ps. i tried playing around removing some of the url post fields  "&gl=GB&m=0&pc=m&uxe=eomtm&cm=2&hl=en&src=1" but any changes seemed to break it.

Attachment
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Guru
cogier is in the usergroup ‘Guru’
 Thanks, Bruce. I'll check it out.
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
Ps. you can see my house from there ;)  lol
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
Here's a different version that may work better in other locations as i'm not sure how important the properties of the post args are.

This version does in code what i originally did, it uses HttpClient.Download to fetch the url and then extracts the link from the page…

Code (gambas)

  1.  
  2. Public Sub Form_Open()
  3.  
  4.   Me.H = Desktop.H
  5.   Me.W = Desktop.W / 2
  6.   Me.X = Desktop.W / 2
  7.   Me.Y = 0
  8.  
  9.   WebView1.Url = GetMappAdress("https://www.google.com/maps/@50.6945657,-1.2873369,12z")
  10.  
  11.  
  12. Public Sub GetMappAdress(Address As String) As String
  13.  
  14.   Dim sHtml As String = HttpClient.Download(Address)  ' get the page
  15.  
  16.   Dim iStartPos As Integer = InStr(sHtml, "HREF=\"") + 6  ' extract the link
  17.   sHtml = Mid(sHtml, iStartPos, InStr(sHtml, "\">", iStartPos) - iStartPos)
  18.  
  19.   sHtml = Replace(sHtml, "amp;", "") ' convert &amp; to just &
  20.  
  21.   Return sHtml
  22.  
  23.  
Online now: No Back to the top
1 guest and 0 members have just viewed this.