Why I get two <loadFinished> signal sometimes?
here is the console message:
I think the main reason should be the problem of the website, could be coused by ajax or frame?
You can try to visit "www.baidu.com" and search something, when opening new page, the slot is invoked, when loading is finished, slot is invoed again. but if i refresh the new page, there is the only one <loadFinished> signal.
$(document).ready(); is not work well...
Thank you in advance.
@QBoy Finally i find something.
here is the content of page when the first signal <loadFinished> was emited.
here is the content of page when the second signal <loadFinished> was emited.
The image illustrate that when load new page, the WebEngine construct a new simple page first, which has a "Refresh" attribute. then "refresh" action triggered. But When I test other site, there is No such situation. In a conclusion, the problem is caused by website's behavior. if website decide to use ajax to load content, when you click the link in this page, the signal <loadFinished> will be not emited. The signal <loadFinised> is NO problem!
Hi and welcome to devnet,
The upload function of the forum is currently broken. Can you use an other image upload site so we can see them ?
When the dom changed or reloaded, or click herf, the loadFinished signal emited. I user a variable value to record the load status.such as:
m_bLoadIndexSucced = true;
//write you code
@Lankin Thanks, but How to make sure that when the first signal <loadFinished> is emitted, the page is really & totally loaded? Is this could be a potential problem?
you can construct new QWebChannel in js file when $(document).ready().
js can invoke c++ method when construct the QWebChannel finished.
I use Qt5.4(webView)、Qt5.6(webEngineView)、Qt5.7, the js just run once.