0

I want to show the page content inside the app when click on the link. Not opening in the browser.

I have this in my config.xml

<widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <content src="index.html" />
    <access origin="*" />
<plugin name="cordova-plugin-inappbrowser" source="npm" />
<plugin name="cordova-plugin-whitelist" source="npm" />
</widget>

This opens in the browser

    <a href="#" onclick="window.open('http://www.kidzout.com', '_system');">www.kidzout.com</a>

This does nothing:

$.each(data, function(index, value) {
console.log(value.featured_image);
      $('ul.homepost-list').append('<li class="homepost-list__item">' +
''<a href="#" onclick="window.open('+value.link+', \'_self\');">'+
'<img width="100" height="75" src="'+value.fimg_url+'" alt="'+value.title.rendered+'"/>'+
      '<h3>'+value.title.rendered+'</h3>' +
      '<p>'+value.excerpt.rendered+'</p>'+
'</a>'+
'</li>');
;
    })

This opens the page in browser:

$.each(data, function(index, value) {
console.log(value.featured_image);
      $('ul.homepost-list').append('<li class="homepost-list__item">' +
'<a href="'+value.link+'">'+
'<img width="100" height="75" src="'+value.fimg_url+'" alt="'+value.title.rendered+'"/>'+
      '<h3>'+value.title.rendered+'</h3>' +
      '<p>'+value.excerpt.rendered+'</p>'+
'</a>'+
'</li>');
;
    })

I just want to show/open the link inside the app. how can do that? and I am checking this all in android.

1 Answers1

0

use this in your javascript to open link in app browser. You could also refer to this answer

window.open('your_link.com', '_self ', 'location=yes');