Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
29
rated 0 times [  30] [ 1]  / answers: 1 / hits: 22804  / 10 Years ago, tue, april 1, 2014, 12:00:00

I have a Cordova/Phonegap application. that on start checks the internet connection.
Actually the app executes local files, but I would, that when there is internet connection, my app loads an external webpage (which is the online version of my app).



How can I achieve this? I have already the script for check internet connection.



Thanks!


More From » html

 Answers
2

You can Load an external page to the app using Jquery load() or by Ajax or by InApp browser.



If you want to show the external page to a div, you can do it by load() or by ajax call



HTML:



<div id=Load></div>
<hr/>
<div id=ajax></div>


JS:



/*Using Jquery Load()*/
$('#Load').load('http://www.google.co.in');

/*Using ajax*/
$.ajax({
dataType:'html',
url:'http://www.google.co.in',
success:function(data) {
$('#ajax').html($(data).children());
}
});


OR by Inapp browser



 window.open('http://www.google.co.in','_self');


go through the documentation



Before using inappbrowser you must install the plugin to your project
To add inappbrowser to project by commanline



$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git


Hope this will helps you.


[#71671] Monday, March 31, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jocelynkarsynr

Total Points: 472
Total Questions: 98
Total Answers: 96

Location: Macau
Member since Mon, Nov 16, 2020
4 Years ago
jocelynkarsynr questions
Tue, Feb 8, 22, 00:00, 2 Years ago
Sat, Jul 11, 20, 00:00, 4 Years ago
Sun, May 10, 20, 00:00, 4 Years ago
Sat, Jan 18, 20, 00:00, 4 Years ago
;