Hi Chris,
I had the same problems. On checking with Corona sdk docs, i found that WebView is displayed on top of every other display object like buttons, images etc. So placing a close button on top of it did not work for me. Maybe there is another way but till then i used a WebPopup because of two reasons:-
-
WebPopup automatically closes on back button press on the device
-
It can be closed via code using the native.cancelWebPopup( ) function
I wanted to display an html page with a close button in the shape of a small circular button on top right hand corner of the html page. The code below shows what i did
-- i called this function on a button press, since the button press event is a tap event -- so i do not check for event.phase == "began" or "ended" local function doSomething() -- i left 100 units of height from the top of the screen to display the close button webview = native.showWebPopup( 0, 100, display.contentWidth, display.contentHeight, url) btnClose.isVisible = true -- this is the button which closes the WebPopup end -- this function is called on clicking the close button -- close button is created via widget library local function closeWV() native.cancelWebPopup( ) btnClose.isVisible = false end
Hope it helps a bit!