<html><body>
<a href="http://google.com" id="alink">link</a>
<script>
document.getElementById("alink").click();
</script>
When I load a page in QTWebkit with such content, the page doesn't jump to href location "http://google.com". It can jump with mouse click on the label A.
I think it's the problem of the JS function "click".
Can anyone help me to solve the problem?
Regards,
Eric
Added after 52 minutes:
I think it's because QTWebkit not support the JS function click. After add below JS code in html page, it works.
My problem is how to add the JS in any page automatic for all pages request.
<script type="text/javascript">
if(typeof HTMLElement!='undefined'&&!HTMLElement.prototype.c lick)
HTMLElement.prototype.click=function(){
var evt = this.ownerDocument.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt); }
</script>
Bookmarks