Page 1 of 2
Problem Showing website page on start page using InAppBrowser
Posted: Wed Mar 26, 2014 10:25 pm
by Tro Murphey
I have the following javascript on the device ready event (I have also tested it with the "load" event) on the start page.
var URL = encodeURI(url);
var ref = window.open('http://www.google.com', '_blank');
alert('ref='+ref);
The web page does not appear on my ApperyIo App on my iphone (I know it is not supposed to work on the chrome web browser). The alert window does not appear either. Can you tell me what is wrong?
If I comment out the 'encod..' line and the 'window..' line the alert will show on my iPhone.
suggestions?
Problem Showing website page on start page using InAppBrowser
Posted: Wed Mar 26, 2014 10:36 pm
by Tro Murphey
I found the issue, forgot to load url. Duh!
Problem Showing website page on start page using InAppBrowser
Posted: Wed Mar 26, 2014 10:41 pm
by Tro Murphey
Well, still doesn't work on iPhone.
The app starts but the webpage does not show.
Testing with Chrome browser, it shows the webpage in a separate browser window.
Suggestions????
Problem Showing website page on start page using InAppBrowser
Posted: Wed Mar 26, 2014 10:48 pm
by Tro Murphey
I have changed the code to :
var URL = encodeURI('http://www.google.com');
var ref = window.open(URL, '_blank');
alert('ref='+ref);
On my iPhone the alert shows that 'ref' is undefined.
Can you tell me what is wrong?
Problem Showing website page on start page using InAppBrowser
Posted: Thu Mar 27, 2014 12:09 am
by Igor
Hello,
Your code looks correctly to me. Could you please try to execute this code:
pre
var ref = window.open('http://apache.org', '_blank', 'location=yes');
/pre
on button click event.
This links should be helpful:
http://docs.appery.io/tutorials/using...
http://docs.phonegap.com/en/3.3.0/cor...
Problem Showing website page on start page using InAppBrowser
Posted: Thu Mar 27, 2014 2:56 pm
by Tro Murphey
Thanks for the links, but I already discovered those links while researching this problem.
I placed a button on my start page with the 'window.open...' above, executing as a button click event. This code works on my iPhone when I click the button.
I also replaced my 'window.open...' with your 'window.open...' above on my start page executing javascript on the 'Load' event. It still does not work on my iPhone. The alert window says that 'ref is undefined'.
Why doesn't it work on the 'Load' event? I also tried the 'Device Ready' event with same effect.
Problem Showing website page on start page using InAppBrowser
Posted: Thu Mar 27, 2014 6:42 pm
by Nikita
Hello,
The matter is that the function windows.open returns nothing, so alert shows "undefined".
Problem Showing website page on start page using InAppBrowser
Posted: Thu Mar 27, 2014 9:24 pm
by Tro Murphey
The problem is not the alert. I just use that for debugging.
The problem is that the web page does not display in the InAppBrowser when called from the start page in the 'load' or 'device ready' event.
If I take the alert out, it still does not show the webpage when the app starts.
Problem Showing website page on start page using InAppBrowser
Posted: Fri Mar 28, 2014 12:34 am
by Illya Stepanov
Hi - can you share your app with us, so we can try it? (what device you're testing and what OS version is used).
Problem Showing website page on start page using InAppBrowser
Posted: Fri Mar 28, 2014 12:39 am
by Tro Murphey
How do I share the app with you?
I use the iPhone with version iOS 7.1