Delphi WebBrowser无法执行javascript执行...但是IE可以正常工作 [英] Delphi WebBrowser fails javascript exec...but IE works
问题描述
我正在使用Delphi Twebbrowser对象实现在网站上导航的应用程序:最后一步是单击链接.与链接关联的事件是我的噩梦,因为:
-如果我尝试触发事件(parentWindow.ExecScript)或单击链接,则会得到
错误:类似对象为空"之类的东西...如果我选择继续执行,则什么也不会发生.
-虽然...如果我没有按代码单击链接,而是单击鼠标,脚本将打开一个新窗口,并且可以正常工作.
我还为"OnNewWindow2"编写了一个处理程序:如果我用鼠标单击链接,则事件将触发...但是通过代码,它会休眠...
有没有人可以帮助我?请帮助我!
非常感谢...我希望您能理解我的英语不好...
Hi,
I''m implementing an application which navigate on a website, using Delphi Twebbrowser object: as final step, there''s a link to click. The event associated with the link is my nightmare, because:
- if I try to fire the event (parentWindow.ExecScript) or to click on the link, I get
an error: something like "the object is null"...if I select to continue the excecution, nothing happens.
- While...if I don''t click on the link by code, and I do it with the mouse click, the script open a new window and it works fine.
I also wrote an handler for "OnNewWindow2": if I click on the link with mouse, the event fires...but by code, it sleeps...
Is there someone can help me? PLEASE HELP ME!
Thanks a lot...I hope you understand my poor english...
推荐答案
您需要检查链接是否为实际网址,或者是否为实际网址javascript链接.
首先检查此链接,描述如何确定需要处理哪种链接.
http://stackoverflow.com/questions/11556943/opening-twebbrowser-link-in-默认浏览器 [ ^ ]
这里有一些有关执行javascript的额外信息:
http://www.delphidabbler.com/articles?article=21 [
You need to check if the link is an actual url, or if it is a javascript link.
First check out this link, describing how to determine what kind of link needs to be handled.
http://stackoverflow.com/questions/11556943/opening-twebbrowser-link-in-default-browser[^]
Here some extra info on executing javascript:
http://www.delphidabbler.com/articles?article=21[^]
The most important is the first, because I think you are now executing an actual link as javascript.
If you need more help, please edit this question and add some code.
Good luck!
您好,谢谢您的回答...但我仍在做噩梦:-)
链接是一个javascript链接,这是代码:
Excel
请帮我! :-)
Hi, thanks for your answer...but I''m still living my nightmare :-)
The link is a javascript link, this is the code:
Excel
Please help me! :-)
抱歉,标记之间的代码是:
" onclick ="
Sorry, the code between tag is:
""onclick="
这篇关于Delphi WebBrowser无法执行javascript执行...但是IE可以正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!