[SOLVED] Cannot return properly from native.showWebPopup

Here goes:
I have a Credits screen. I have some peeps that I am tipping including Corona. Since I do not have control over these pages, I cannot put a button on them with the ol’ “corona:close” action. So I encapsulated them with a local html file as follows:


<iframe src="http://www.anscamobile.com" width="768px" height="960px" frameborder="0"></iframe>

  
<form name="clostit" action="corona:close" style="margin: 0; text-align: center;">
<br>	<input type="submit" value="Close"><br>
</form>
  
   
[/html]  

then using:

local options = {baseUrl=system.ResourceDirectory, urlRequest=webHandler}  
native.showWebPopup("localfile.html", options)  

and the handler:

 local webHandler = function(event)  
 local url = event.url  
 local shouldLoad = true  
 print(url)  
 if(url)then  
 if 1 == string.find(url, "corona:close") then  
 shouldLoad = false  
 native.cancelWebPopup()  
 end  
 end   
 return shouldLoad  
 end  

Now when the close button is tapped, the popup fades out and brings me back to the credits screen but I’m locked up. Nothing else responds to events. Also, the print(url) does not show up in the Console (while running from the device of course).

All I want to do is close the darn webpage and return to gaming, anyone? :slight_smile: [import]uid: 21331 topic_id: 21837 reply_id: 321837[/import]

Hey Tony,

What version of Corona are you using? [import]uid: 52491 topic_id: 21837 reply_id: 86792[/import]

Oop, sorry. Build is 744. [import]uid: 21331 topic_id: 21837 reply_id: 86850[/import]

Interesting - I just ran this on 746 and got a crash, which I then fixed by using a slight delay on the native.cancelWebPopup. Doing that also let me control everything from the scene again.

Could you try a slight delay OOI and let me know if that makes a difference, please?

Peach :slight_smile: [import]uid: 52491 topic_id: 21837 reply_id: 86862[/import]

No joy. Tried on 744 and 746. Tried 1 and 10ms delay. Are you performing the test using my encapsulation method?

Thank you so much for taking the time. [import]uid: 21331 topic_id: 21837 reply_id: 86952[/import]

Aaaaarrrrrggghhhhh…
bumpity, bump, bump

Anyone else have any ideas? [import]uid: 21331 topic_id: 21837 reply_id: 87006[/import]

Oooohhh Nooooo!

Your solution was actually correct! In my frantic fumbling I deleted a flag that prevents a double-tap. When it returned it was still set to false preventing further button press events from executing code…

Thank you so much again Peach, you’re the best!

Pretty soon I’m gonna get myself ejected from this forum for idiocy… :slight_smile: [import]uid: 21331 topic_id: 21837 reply_id: 87013[/import]

Hah, glad to hear it :wink:

I was out for most of today so only got in now - maybe try to avoid frantic bumps when it’s only been a little over 2 hours though, heh.

Peach :slight_smile: [import]uid: 52491 topic_id: 21837 reply_id: 87056[/import]

Oof. Salt applied. Thank you. :wink: lol [import]uid: 21331 topic_id: 21837 reply_id: 87079[/import]