I have a simple web popup. When a button is tapped a web popup opens. The code is as follows:
local goButton = display.newImage("go\_button.png") goButton.x = display.contentWidth \* 0.5 goButton.y = display.contentHeight \* 0.5 function goButton:tap(e) local scale0= ((display.actualContentWidth- display.contentWidth)\*.5)\*-1 local scale0Y= ((display.actualContentHeight- display.contentHeight)\*.5)\*-1 native.showWebPopup( scale0, scale0Y, display.actualContentWidth, display.actualContentHeight ,"https://coronalabs.com/") end goButton:addEventListener("tap", goButton)
Now when I tap on the “Go” button it shows a white screen until it loads the website. I want to displays an image until the webpopup loads fully.
I tried this:
local function onWebViewEvent(event) if not "loaded" == event.type then print("Loading: ", event.url ) end end local scale0= ((display.actualContentWidth- display.contentWidth)\*.5)\*-1 local scale0Y= ((display.actualContentHeight- display.contentHeight)\*.5)\*-1 local webView = native.newWebView( scale0, scale0Y, display.actualContentWidth, display.actualContentHeight ) webView:addEventListener("urlRequest", onWebViewEvent) webView:request("http://www.coronalabs.com")