如果不是框架网页
可以使用for循环查询links集合的方式获取所有链接
但是在框架网页中
这种方法得不到链接
请问如何解决?
可以使用for循环查询links集合的方式获取所有链接
但是在框架网页中
这种方法得不到链接
请问如何解决?
解决方案 »
- 如何拦截FORM上的控件的消息?
- 各位帮我看看这段简单的~小程序~~~~~~
- 怎么用Report Machine打印窗体中DBGrid的一行信息???
- 关于批量数据更新问题,大家有什么好建议?
- 我用DBNavigator+DBGrid控制数据的删除、修改操作后无法提交数据和刷新?急!!!!!!!!!
- 大家来拿高分!!!!!!!!!!
- help!为什么我在删除access数据时老提示“键列信息不足或不正确,更新影响到过多的行”,这是什么原因?该如何解决?谢谢!
- 非常渴望-StringGrid1使用!!!
- 关于ADO的一个问题?(高分馈赠)
- 一个值得讨论的问题,一个饶有趣味的问题,非计算机专业的人可能搞不清楚
- 请问怎么变成修改本地安全策略?
- 关于AdoQuery的Filter处理日期类型的问题.
begin
WebBrowser1.Navigate('http://community.csdn.net');
end;procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant); procedure pScanFrames(mHTMLDocument2: IHTMLDocument2);
var
vIndex: OleVariant;
I: Integer;
vDispatch: IDispatch;
vHTMLAnchorElement: IHTMLAnchorElement;
begin
if not Assigned(mHTMLDocument2) then Exit;
for I := 0 to mHTMLDocument2.links.length - 1 do
begin
vHTMLAnchorElement := (mHTMLDocument2.links.item(I, 0) as IHTMLAnchorElement);
Memo1.Lines.Add(vHTMLAnchorElement.href);
end;
for I := 0 to mHTMLDocument2.frames.length - 1 do
begin
vIndex := I;
vDispatch := mHTMLDocument2.frames.item(vIndex);
pScanFrames((vDispatch as IHTMLWindow2).document);
end;
end;
begin
Memo1.Clear;
if not SameText('http://community.csdn.net/', URL) then Exit;
pScanFrames(TWebBrowser(Sender).Document as IHTMLDocument2);
end;
在某个网站试验的时候~
提示"拒绝访问"~
break以后停在这一句:
pScanFrames((vDispatch as IHTMLWindow2).document);
这是为什么?
如果框架里的网页连接是另一个域名,则不能访问该框架的document等接口
避免一些人的流氓行为--把别人的网页嵌到自己的页面,并修改其内容
那用IdHTTP读框架中各个页面的源代码有可能么?
还有这个网页是Session验证的~
You are free to change the request headers and interpret the responses.