native.newWebView()

Im using the native.newWebView() example up on mobile tuts - http://mobile.tutsplus.com/tutorials/corona/corona-sdk-webview/

I wanted to embed a url inside an app - however the url I am embedding is a mobile version of a website. If I was to go to that url directly it would detect I am on a mobile device and give me the mobile version of the site. I have taken that url and used it directly to that the mobile version should appear in my app. For some reason though it doesnt seem to be displaying as it should. I am wondering if the issue is that the url cant detect the user agent of the simulator or if it was a device the same issue would occur.

Is it possible to pass in a user agent list to the WebView so that it displays properly and detects the device?

So I think I managed to fix the problem - I was using the popup not newWebView.

Is it possible to have objects on a layer above the WebView? It doesnt seem to be but is there any hack or way around this?

Thanks

I think the docs say that WebViews are always on the top … “Because native webViews are not part of the OpenGL canvas, they do not obey the Corona display object hierarchy. For example, while they can be manipulated using display object methods, they always appear above normal display objects, and cannot be inserted into display groups.”

Yeah im aware of that but was wondering was there a hack or way around it.

Also is it possible to have an event listener for a close event on the webview. So if there is a popup called on the webview and the person presses a button or submits info and that pop up is supposed to then close that I can pick it up on the event listener and trigger the webview to reload the previous page for example.

Hi I’m also looking for a hack or any workaround for placing an image view above the native webview.
Please let me know if u found anything.

Thanks,

So I think I managed to fix the problem - I was using the popup not newWebView.

Is it possible to have objects on a layer above the WebView? It doesnt seem to be but is there any hack or way around this?

Thanks

I think the docs say that WebViews are always on the top … “Because native webViews are not part of the OpenGL canvas, they do not obey the Corona display object hierarchy. For example, while they can be manipulated using display object methods, they always appear above normal display objects, and cannot be inserted into display groups.”

Yeah im aware of that but was wondering was there a hack or way around it.

Also is it possible to have an event listener for a close event on the webview. So if there is a popup called on the webview and the person presses a button or submits info and that pop up is supposed to then close that I can pick it up on the event listener and trigger the webview to reload the previous page for example.

Hi I’m also looking for a hack or any workaround for placing an image view above the native webview.
Please let me know if u found anything.

Thanks,

is it possible to have an event listener for a close event on the webview. So if there is a popup called on the webview and the person presses a button or submits info and that pop up is supposed to then close that I can pick it up on the event listener and trigger the webview to reload the previous page for example.

You can try this: 

function websiteView1Listener( event ) -- print event type and URL print("Event type: "..event.type) print("URL: "..event.url) end websiteView1 = native.newWebView( display.contentWidth \* 0.5, display.contentHeight \* 0.5, 300, 300 ) websiteView1:request( "www.myWebviewURL.com") websiteView1:addEventListener( "urlRequest", websiteView1Listener )

websiteView1Listener gets called everytime the user clicks anything on the webview website. So you get a handle to do your own manipulation or close the webview etc.

is it possible to have an event listener for a close event on the webview. So if there is a popup called on the webview and the person presses a button or submits info and that pop up is supposed to then close that I can pick it up on the event listener and trigger the webview to reload the previous page for example.

You can try this: 

function websiteView1Listener( event ) -- print event type and URL print("Event type: "..event.type) print("URL: "..event.url) end websiteView1 = native.newWebView( display.contentWidth \* 0.5, display.contentHeight \* 0.5, 300, 300 ) websiteView1:request( "www.myWebviewURL.com") websiteView1:addEventListener( "urlRequest", websiteView1Listener )

websiteView1Listener gets called everytime the user clicks anything on the webview website. So you get a handle to do your own manipulation or close the webview etc.