Link to home
Start Free TrialLog in
Avatar of epagos
epagosFlag for Argentina

asked on

How can i read Frame content with TWebBrowser?

Hello

im making a software for my company and i need to read the frame content (wich are from other domains) and assign them to a var. Im using TWebBrowser component since it interpret js code, but im getting "access is denied" error due to cross domain security. How can i bypass it? and if its not possible is there any component wich will allow me to read the frame content (the component MUST execute js code).

Thanks a lot.

Elias
procedure TForm1.Button1Click(Sender: TObject); 
var
  i: integer; 
begin 
  for i := 0 to (WebBrowser1.OleObject.Document.frames.Length - 1) do 
    if WebBrowser1.OleObject.Document.frames.item(i).document.queryCommandEnabled('Copy') then 
      ShowMessage('copy command is enabled for frame no.' + IntToStr(i));
end;

Open in new window

Avatar of B_Dorsey
B_Dorsey

Is it login data from the frame window? For instance the data on the page you are trying to scrape is user login based? If not I just have my server call the frame url and grab the data via xmlhttp (ASP) or anoter way via some other server side language... if its login based, I think you are SOL.
Avatar of epagos

ASKER

no, its login based.
And yes i have tried to retrieve frames url through another browser request. But on this case i must get the code WITHOUT any additional requests.
You might want to check this out
https://www.experts-exchange.com/questions/21214157/Webbrowser-Getting-form-elements-in-frames.html

It's a bit of a read, but worth it.
:-)
ASKER CERTIFIED SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin