0

I am trying to find a way to detect whether an url is an invalid url for a webview

For example, if I do

myWebView->setUrl(QUrl("http://www.youtube.com")); //then the webview will change to that page, but if I do...

myWebView->setUrl(QUrl("youtube.com")); //it will not change, because it considers it an invalid url.

Is there some kind of signal, or some sort of property that I can use to detect that?

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
user1296259
  • 521
  • 1
  • 13
  • 33

2 Answers2

1

Yes you have solution for this:

You can use inbuilt function isValid();

For eg :

myWwebView->url().isValid(); //It will return true or false value.

For more help refer following link

The iOSDev
  • 5,237
  • 7
  • 41
  • 78
  • Thankyou, but unfortunately this does not work. My example of "youtube.com" that does not load a website still passes the url().isValid test - eventhough it takes "http://www.youtube.com" to load the page. I guess what I am really asking for is a test to see if the webpage has loaded successfully or not or is able to load successfully. I see there is a QWebView, that has a signal loadFinished(bool ok), where ok tells you if the load is successful, but I am using Blackberry Cascades Webview and QML. – user1296259 Jan 08 '13 at 16:21
0

You can connect to the WebView's loadingChanged signal to find out if a page loaded successfully or not.

D H
  • 1