Juan Young 0 Posted April 20, 2020 I have apps with TWebbrowser.loadstrings and there is many a href link but if i click that link webbrowser navigate that link.. How can i get that link on event on click / on tab or something ? i see event on TWebbrowser is not exist.. Share this post Link to post
Remy Lebeau 1396 Posted April 20, 2020 14 hours ago, Juan Young said: How can i get that link on event on click / on tab or something ? i see event on TWebbrowser is not exist.. VCL's TWebBrowser has an OnBeforeNavigate2 event. FMX's TWebBrowser has OnShouldStartLoadWithRequest and OnDidStartLoad events. Share this post Link to post
Juan Young 0 Posted April 20, 2020 47 minutes ago, Remy Lebeau said: VCL's TWebBrowser has an OnBeforeNavigate2 event. FMX's TWebBrowser has OnShouldStartLoadWithRequest and OnDidStartLoad events. i'm already try.. not work... onShouldStartLoadWithRequest is not fire anything OnDidStartLoad = will start all link embeded on that html... so confuse.. Share this post Link to post
Remy Lebeau 1396 Posted April 21, 2020 4 hours ago, Juan Young said: i'm already try.. not work... onShouldStartLoadWithRequest is not fire anything Clicking on a hyperlink starts a load request. You should be getting events for that. Lets starts with the obvious - did you actually ASSIGN a handler to that event? 4 hours ago, Juan Young said: OnDidStartLoad = will start all link embeded on that html... so confuse.. I'm confused. What are you trying to say exactly? Can you provide a ste-by-step example? Share this post Link to post
Juan Young 0 Posted April 21, 2020 (edited) 5 hours ago, Remy Lebeau said: Clicking on a hyperlink starts a load request. You should be getting events for that. Lets starts with the obvious - did you actually ASSIGN a handler to that event? I'm confused. What are you trying to say exactly? Can you provide a ste-by-step example? tags := tstringlist.Create; tags.Add(dataweb); tags.SaveToFile(System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html'); if FileExists(System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html') then begin tags.LoadFromFile(System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html'); end; tags.Free; wb1.URL:=System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html'; wb1.Navigate; like that.. and in at DataTampilan.html have lot link A Href... how i can catch if i click that link because if i OnDidStartLoad on that wb1 it will catch 5 times as sum as a href if i click that url on right WB1 is not fire test on debug view >,,< Edited April 21, 2020 by Juan Young add image Share this post Link to post
Remy Lebeau 1396 Posted April 21, 2020 12 hours ago, Juan Young said: in at DataTampilan.html have lot link A Href... how i can catch if i click that link I already told you how. Clicking on a hyperlink inside the HTML is supposed to fire the OnShouldStartLoadWithRequest and OnDidStartLoad events. If it is not, then you should file a bug report. 12 hours ago, Juan Young said: because if i OnDidStartLoad on that wb1 it will catch 5 times as sum as a href I don't understand what you are describing, but that doesn't seem to match with your screenshot. 12 hours ago, Juan Young said: if i click that url on right WB1 is not fire test on debug view >,,< Are you running your code in the IDE's debugger? If so, the messages will go to the debugger's output window, not to DebugView. Share this post Link to post
ipay 0 Posted October 14, 2020 On 4/21/2020 at 12:32 PM, Juan Young said: tags := tstringlist.Create; tags.Add(dataweb); tags.SaveToFile(System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html'); if FileExists(System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html') then begin tags.LoadFromFile(System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html'); end; tags.Free; wb1.URL:=System.IOUtils.TPath.GetDocumentsPath + PathDelim + 'DataTampilan.html'; wb1.Navigate; like that.. and in at DataTampilan.html have lot link A Href... how i can catch if i click that link because if i OnDidStartLoad on that wb1 it will catch 5 times as sum as a href if i click that url on right WB1 is not fire test on debug view >,,< Hi, I'm using this code : procedure Tfrm_isi.WebBrowser1DidStartLoad(ASender: TObject); var url : string; begin url := WebBrowser1.URL; if url<>'about:blank' then begin //do here end; end; regards, Ipay Share this post Link to post
Juan Young 0 Posted November 19, 2020 On 10/14/2020 at 9:16 PM, ipay said: Hi, I'm using this code : procedure Tfrm_isi.WebBrowser1DidStartLoad(ASender: TObject); var url : string; begin url := WebBrowser1.URL; if url<>'about:blank' then begin //do here end; end; regards, Ipay hi ipay that event didn't fire >,< regard Share this post Link to post
Dave Nottage 557 Posted November 19, 2020 1 hour ago, Juan Young said: that event didn't fire It won't fire if it cannot. OnShouldStartLoadWithRequest should fire for every URL that is visited. As Remy said, if it does not, then there's a bug. Share this post Link to post
Juan Young 0 Posted November 20, 2020 19 hours ago, Dave Nottage said: It won't fire if it cannot. OnShouldStartLoadWithRequest should fire for every URL that is visited. As Remy said, if it does not, then there's a bug. hi, i tried code like below and i open Debugview.. didn't fire anything too.. >,<.. procedure TFrameTampilanData.WB1ShouldStartLoadWithRequest(ASender: TObject; const URL: string); begin outputdebugstring(PwideChar(URL)); end; regard Share this post Link to post
Remy Lebeau 1396 Posted November 20, 2020 2 hours ago, Juan Young said: i tried code like below and i open Debugview.. didn't fire anything too.. >,<.. Odd. Are you ABSOLUTELY SURE that those event handlers are actually assigned to the TWebBrowser? Share this post Link to post
Dave Nottage 557 Posted November 20, 2020 3 hours ago, Juan Young said: i tried code like below and i open Debugview Running it from the IDE, or standalone? If you run it from the IDE, the messages appear in the Messages window of the IDE Share this post Link to post