Can’t see anything in the documentation with regards to closing a native.newWebView. It does say on Android you use the back button but iOS doesn’t have one so not sure.
Any help appreciated.
Thanks,
Dave
Can’t see anything in the documentation with regards to closing a native.newWebView. It does say on Android you use the back button but iOS doesn’t have one so not sure.
Any help appreciated.
Thanks,
Dave
I didn’t see anything in the docs either, which is odd.
You should put in a request for more details by clicking the ‘Report An Issue’ button at the bottom of this page:
https://docs.coronalabs.com/api/library/native/newWebView.html
Then, make note of the fact that it isn’t clear how to close the webview and ask for an update to the docs.
Meanwhile, what happens if you delete the handle to the webview?
local webView = native.newWebView( display.contentCenterX, display.contentCenterY, 320, 480 ) ... later (webView variable must be in scope for this to do anything) display.remove( webView )
I’m using display.remove(webView) for a long time without a problem.
the problem is not closing, is opening 2 times (if you press it very fast 2 times), you will lose the track of the first opened window. so you need to make sure your button to open the webview will only work first time you hit it. after you close the webview you can reset the button so youc an hit him again.
I understand you can remove the web view programatically but was hoping there was a way if it’s full screen.
Am presuming people aren’t making them fullscreen and having a button or something saying close.
Thanks,
Dave
Usually I create a bottom or a top area with a X to close the webview. With some transparency to have that effect of layer.
I think there is a way to close the webview using javascript but for that you need to know and control the webpage you are seeing in the webview. other option if your doing for android is using the back button. if you want full screen on ios you can open a popup webview and IOS have a back to app on top so you dont need to worry about that…
If you have control over the HTML that’s show in the webView you can provide a close button and perhaps use a URL like: corona:close or yourappname:close. When the link it activated (i.e. clicking on the button), Corona will get an event passed to it that has the clicked on URL. You can do a simple “if” test inside the listener:
if event.url == "corona:close" then webView:removeSelf() end
or something similar (untested code).
Rob
Hi,
It’s iOS only and don’t have control of HTML as it’s opening youTube and Spotify.
Think am gong to have to go with making it slightly smaller and putting a button or something to close the web view. Will look ugly as hell but don’t see any other option.
The app is basically a game, soundboard and links to youTube and Spotify. It’s for a Radio 1 DJ here in the UK but can’t say more than that.
EDIT: Gone with the button across the full width of the screen and it doesn’t look to bad actually.
Thanks,
Dave
I didn’t see anything in the docs either, which is odd.
You should put in a request for more details by clicking the ‘Report An Issue’ button at the bottom of this page:
https://docs.coronalabs.com/api/library/native/newWebView.html
Then, make note of the fact that it isn’t clear how to close the webview and ask for an update to the docs.
Meanwhile, what happens if you delete the handle to the webview?
local webView = native.newWebView( display.contentCenterX, display.contentCenterY, 320, 480 ) ... later (webView variable must be in scope for this to do anything) display.remove( webView )
I’m using display.remove(webView) for a long time without a problem.
the problem is not closing, is opening 2 times (if you press it very fast 2 times), you will lose the track of the first opened window. so you need to make sure your button to open the webview will only work first time you hit it. after you close the webview you can reset the button so youc an hit him again.
I understand you can remove the web view programatically but was hoping there was a way if it’s full screen.
Am presuming people aren’t making them fullscreen and having a button or something saying close.
Thanks,
Dave
Usually I create a bottom or a top area with a X to close the webview. With some transparency to have that effect of layer.
I think there is a way to close the webview using javascript but for that you need to know and control the webpage you are seeing in the webview. other option if your doing for android is using the back button. if you want full screen on ios you can open a popup webview and IOS have a back to app on top so you dont need to worry about that…
If you have control over the HTML that’s show in the webView you can provide a close button and perhaps use a URL like: corona:close or yourappname:close. When the link it activated (i.e. clicking on the button), Corona will get an event passed to it that has the clicked on URL. You can do a simple “if” test inside the listener:
if event.url == "corona:close" then webView:removeSelf() end
or something similar (untested code).
Rob
Hi,
It’s iOS only and don’t have control of HTML as it’s opening youTube and Spotify.
Think am gong to have to go with making it slightly smaller and putting a button or something to close the web view. Will look ugly as hell but don’t see any other option.
The app is basically a game, soundboard and links to youTube and Spotify. It’s for a Radio 1 DJ here in the UK but can’t say more than that.
EDIT: Gone with the button across the full width of the screen and it doesn’t look to bad actually.
Thanks,
Dave