problem getting white screen in native.newWebView()

hi,

i’m using my app to display a website and i’m displaying it using native.newWebView,

the site require you to login to facebook

the problem is once you loged in after the facebook screen i simply return to get a white screen and i can’t do anything. 

i thought before it has somthing to do with opening another window but it stays in the same window.

in the safari in the device it works fine.

and when i build for android it works fine as well

it only happens on iphone devices and on the webview gadget.

help ?!?

anyone ?

how do i fix it ?

Hi @juve,

Can you post some code here?

offcures

this is how i open the site itself

local function webListener( event )

    if event.url then

        print( "You are visiting: " … event.url )

    end

    if event.type then

        print( "The event.type is " … event.type ) – print the type of request

    end

    if event.errorCode then

        print ("The Error is: "… event.errorMessage)

        display.remove (webView) 

        webView = nil

    end

end

local webView = native.newWebView( 1000, 0, 640, 850, webListener)

webView:request( “http://tv-games.co.il/” )

webView:addEventListener( “urlRequest”, webListener )

Do you have the Facebook app installed?   Do you have any facebook AppID’s in your build.settings file?

Hi @juve,

Can you post some code here?

offcures

this is how i open the site itself

local function webListener( event )

    if event.url then

        print( "You are visiting: " … event.url )

    end

    if event.type then

        print( "The event.type is " … event.type ) – print the type of request

    end

    if event.errorCode then

        print ("The Error is: "… event.errorMessage)

        display.remove (webView) 

        webView = nil

    end

end

local webView = native.newWebView( 1000, 0, 640, 850, webListener)

webView:request( “http://tv-games.co.il/” )

webView:addEventListener( “urlRequest”, webListener )

Do you have the Facebook app installed?   Do you have any facebook AppID’s in your build.settings file?

Hey @Rob.

I’ve been getting the same white screen in some url’s. I have FB installed and FB ID (i’m using connect and it works). 

Is there a connection between the two?

is there a solution for this?

BR,

Shahar

Hey @Rob.

I’ve been getting the same white screen in some url’s. I have FB installed and FB ID (i’m using connect and it works). 

Is there a connection between the two?

is there a solution for this?

BR,

Shahar

The same problem here. Corona Version 2013.1137 (2013.6.7)

Code Lua:
 

local function webListener( event ) local URLA = event.url if event.url then print( "You are visiting: " .. event.url ) end end local webView = native.newWebView( 0, 0, 320, 480 ) webView:request("http://xxx.xxxx.xxx/xxxxxxxxx") webView:addEventListener( "urlRequest", webListener )

Code HTML:
 

\<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"\> \<HTML\> \<!--HEAD----------------------------------------------------------------------\> \<HEAD\> \<META NAME="Keywords" VALUE="Quiz, Dilemma"\> \<META NAME="Description" VALUE="DilemmaQuiz"\> \<META NAME="rating" CONTENT="general"\> \<META NAME="revisit-after" CONTENT="7 days"\> \<TITLE\>Dilemma Quiz\</TITLE\> \<style type="text/css"\> #screen { height: 480px; width: 320px; background: #ffd200; position:relative; z-index:0; } .center{ background: #ffd200; bottom: 0; height: 480px; left: 0; margin: auto; position: absolute; top: 0; right: 0; width: 320px; } #FBbutton { position:relative; z-index:2; top: 225px; left: 130px; } \</style\> \</HEAD\> \<!--BODY----------------------------------------------------------------------\> \<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0" BGCOLOR="#FFFFFF"\> \<div id="fb-root"\>\</div\> \<script\> // Following variables are used in test.pde file var setID; // variable used for invited, passed to HTML by server var myID = 0; var myUSERNAME = ""; var myNAME = ""; var myFRIENDS = new Array(new Array()); var mySTATUS = "create"; // Indicates whether it's create or join state // Additional JS functions here window.fbAsyncInit = function() { FB.init({ appId : 'XXXXXXXXXXXXXXXXXX', // App ID channelUrl : '//www.xxxxxx.xxx/xxxxxxxxxxxx', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); function login(){ FB.api('/me', function(response) { if (response.id \> 0) { myID = response.id; myUSERNAME = response.username; myNAME = response.name; $('#FBbutton').hide(); alert('You have successfully logged in, '+myNAME+"!"); } }); FB.api('/me/friends', function(response) { if(response.data) { $.each(response.data,function(index,friend) { myFRIENDS[index,0] = friend.name; myFRIENDS[index,1] = friend.id; //alert("Yep!"); alert(friend.name + ' has id:' + friend.id + ' index:' + index); }); } else { alert("Log In!"); } }); } function logout(){ //alert('You have successfully logged out!'); } function greet(){ FB.api('/me', function(response) { if (response.id \> 0) { myID = response.id; myUSERNAME = response.username; myNAME = response.name; $('#FBbutton').hide(); alert('Welcome, '+myNAME+"!"); } }); FB.api('/me/friends', function(response) { if(response.data) { $.each(response.data,function(index,friend) { myFRIENDS[index,0] = friend.name; myFRIENDS[index,1] = friend.id; //alert(myFRIENDS[index,0]); alert(friend.name + ' has id:' + friend.id + ' index:' + index); }); } else { alert("Log In!"); } }); } FB.Event.subscribe('auth.login', function(response) { login(); }); FB.Event.subscribe('auth.logout', function(response) { logout(); }); FB.getLoginStatus(function(response) { greet(); }); }; // Load the SDK asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en\_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); \</script\> \<!-- ----------------------------------------------------------------- FACEBOOK LOGIN --\> \<!-- \<fb:login-button id="FBbutton" show-faces="true" width="200" max-rows="1"\>\</fb:login-button\> --\> \<!-- --------------------------------------------------------------------------------- --\> \<script src="jquery-1.10.2.min.js" type="text/javascript"\>\</script\> \<div class="center"\> \<div class="center"\> \</div\> \<fb:login-button id="FBbutton" autologoutlink='true' scope='email, user\_birthday, status\_update, publish\_stream, read\_friendlists'\> \</fb:login-button\> \</div\> \</BODY\> \</HTML\>

It works fine in Safari on iOS, but in webview it opens Facebook login as expected, after username and password is entered it shows just white screen instead of going back to original html file

Sorry for messy code.

 

The same problem here. Corona Version 2013.1137 (2013.6.7)

Code Lua:
 

local function webListener( event ) local URLA = event.url if event.url then print( "You are visiting: " .. event.url ) end end local webView = native.newWebView( 0, 0, 320, 480 ) webView:request("http://xxx.xxxx.xxx/xxxxxxxxx") webView:addEventListener( "urlRequest", webListener )

Code HTML:
 

\<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"\> \<HTML\> \<!--HEAD----------------------------------------------------------------------\> \<HEAD\> \<META NAME="Keywords" VALUE="Quiz, Dilemma"\> \<META NAME="Description" VALUE="DilemmaQuiz"\> \<META NAME="rating" CONTENT="general"\> \<META NAME="revisit-after" CONTENT="7 days"\> \<TITLE\>Dilemma Quiz\</TITLE\> \<style type="text/css"\> #screen { height: 480px; width: 320px; background: #ffd200; position:relative; z-index:0; } .center{ background: #ffd200; bottom: 0; height: 480px; left: 0; margin: auto; position: absolute; top: 0; right: 0; width: 320px; } #FBbutton { position:relative; z-index:2; top: 225px; left: 130px; } \</style\> \</HEAD\> \<!--BODY----------------------------------------------------------------------\> \<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0" BGCOLOR="#FFFFFF"\> \<div id="fb-root"\>\</div\> \<script\> // Following variables are used in test.pde file var setID; // variable used for invited, passed to HTML by server var myID = 0; var myUSERNAME = ""; var myNAME = ""; var myFRIENDS = new Array(new Array()); var mySTATUS = "create"; // Indicates whether it's create or join state // Additional JS functions here window.fbAsyncInit = function() { FB.init({ appId : 'XXXXXXXXXXXXXXXXXX', // App ID channelUrl : '//www.xxxxxx.xxx/xxxxxxxxxxxx', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); function login(){ FB.api('/me', function(response) { if (response.id \> 0) { myID = response.id; myUSERNAME = response.username; myNAME = response.name; $('#FBbutton').hide(); alert('You have successfully logged in, '+myNAME+"!"); } }); FB.api('/me/friends', function(response) { if(response.data) { $.each(response.data,function(index,friend) { myFRIENDS[index,0] = friend.name; myFRIENDS[index,1] = friend.id; //alert("Yep!"); alert(friend.name + ' has id:' + friend.id + ' index:' + index); }); } else { alert("Log In!"); } }); } function logout(){ //alert('You have successfully logged out!'); } function greet(){ FB.api('/me', function(response) { if (response.id \> 0) { myID = response.id; myUSERNAME = response.username; myNAME = response.name; $('#FBbutton').hide(); alert('Welcome, '+myNAME+"!"); } }); FB.api('/me/friends', function(response) { if(response.data) { $.each(response.data,function(index,friend) { myFRIENDS[index,0] = friend.name; myFRIENDS[index,1] = friend.id; //alert(myFRIENDS[index,0]); alert(friend.name + ' has id:' + friend.id + ' index:' + index); }); } else { alert("Log In!"); } }); } FB.Event.subscribe('auth.login', function(response) { login(); }); FB.Event.subscribe('auth.logout', function(response) { logout(); }); FB.getLoginStatus(function(response) { greet(); }); }; // Load the SDK asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en\_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); \</script\> \<!-- ----------------------------------------------------------------- FACEBOOK LOGIN --\> \<!-- \<fb:login-button id="FBbutton" show-faces="true" width="200" max-rows="1"\>\</fb:login-button\> --\> \<!-- --------------------------------------------------------------------------------- --\> \<script src="jquery-1.10.2.min.js" type="text/javascript"\>\</script\> \<div class="center"\> \<div class="center"\> \</div\> \<fb:login-button id="FBbutton" autologoutlink='true' scope='email, user\_birthday, status\_update, publish\_stream, read\_friendlists'\> \</fb:login-button\> \</div\> \</BODY\> \</HTML\>

It works fine in Safari on iOS, but in webview it opens Facebook login as expected, after username and password is entered it shows just white screen instead of going back to original html file

Sorry for messy code.