native.showWebPopup: How to listen when webpage loading is complete

Is there a way to listen when webpage loading is complete in native.showWebPopup?

Thanks.

I use native.newWebView() instead:

http://docs.coronalabs.com/api/library/native/newWebView.html

and there is a “loaded” event that you can use to determine if a webpage loading is completed.

Let me share the behaviors for the loaded event from my experience:

(1) Android & Simulator: you get multiple loaded events for a single webpage. For example, even for a embedded Facebook plugin, you get a loaded event for that component too. You get many loaded events for the components inside a webpage.

(2) For iOS, there is only one loaded event. However, sometimes it comes very early before the web page is actually seen especially after you click some link inside a web page. And the loaded event might be missing for a special case. Please refer to this thread: 

http://forums.coronalabs.com/topic/38007-nativenewwebviews-urlrequest-eventtype-loaded-not-behaving-on-ios-devices/

Thanks for the help.

I using native.newWebView() before, but then i got a problem in some android devices.

The other view object become completely black sometimes when i try tap the input field and then showing the native keyboard or doing pinch zoom, and sometimes the view object back again like a normal.

Then i try use native.showWebPopup, there is no problem but too bad there is no event.type “loaded”.

I think they can’t control that much for the webView about the problem you describe.

The webView is mostly an native component. I have not seen or got complaints from my users about this kind of problem.

And as I remember, showWebPopup() is going to be obsolete?

Maybe you should give newWebView() one more chance?

I use native.newWebView() instead:

http://docs.coronalabs.com/api/library/native/newWebView.html

and there is a “loaded” event that you can use to determine if a webpage loading is completed.

Let me share the behaviors for the loaded event from my experience:

(1) Android & Simulator: you get multiple loaded events for a single webpage. For example, even for a embedded Facebook plugin, you get a loaded event for that component too. You get many loaded events for the components inside a webpage.

(2) For iOS, there is only one loaded event. However, sometimes it comes very early before the web page is actually seen especially after you click some link inside a web page. And the loaded event might be missing for a special case. Please refer to this thread: 

http://forums.coronalabs.com/topic/38007-nativenewwebviews-urlrequest-eventtype-loaded-not-behaving-on-ios-devices/

Thanks for the help.

I using native.newWebView() before, but then i got a problem in some android devices.

The other view object become completely black sometimes when i try tap the input field and then showing the native keyboard or doing pinch zoom, and sometimes the view object back again like a normal.

Then i try use native.showWebPopup, there is no problem but too bad there is no event.type “loaded”.

I think they can’t control that much for the webView about the problem you describe.

The webView is mostly an native component. I have not seen or got complaints from my users about this kind of problem.

And as I remember, showWebPopup() is going to be obsolete?

Maybe you should give newWebView() one more chance?

You can use native.newWebView, I do the following:

-- show activity indicator native.setActivityIndicator( true ) websiteView1 = native.newWebView( display.contentWidth \* 0.5, 210 , display.contentWidth - 40, 400 ) websiteView1:request( theURL ) websiteView1:addEventListener( "urlRequest", websiteView1Listener )

And websiteView1Listener looks like this:

 function websiteView1Listener( event ) print "Entering: websiteView1Listener" if (event.type == "loaded") then print("URL: "..event.url) native.setActivityIndicator( false ) end end

Hope this helps! 

You can use native.newWebView, I do the following:

-- show activity indicator native.setActivityIndicator( true ) websiteView1 = native.newWebView( display.contentWidth \* 0.5, 210 , display.contentWidth - 40, 400 ) websiteView1:request( theURL ) websiteView1:addEventListener( "urlRequest", websiteView1Listener )

And websiteView1Listener looks like this:

 function websiteView1Listener( event ) print "Entering: websiteView1Listener" if (event.type == "loaded") then print("URL: "..event.url) native.setActivityIndicator( false ) end end

Hope this helps!