0

i am trying to have a link in my PhoneGap app, that when a user click/touch the link a page is being open in the user's browser (doesn't matter which one) as long as it opens outside the phone gap app.

I tried this:

    <a href="#" onclick="openUrlInBlankBrowser();" target="_system"  >LINK</a>

Doesn't work :( what am i doing wrong?

Thanks for your help, -- Travis

Travis
  • 1
  • 1

1 Answers1

0

Try this code, I hope this works for you.

<script>
    function loadPage(url) {
        if (url === 1) {
            window.parent.location ="https://facebook.com/";
        } else {
            window.parent.location =" https://twitter.com/";
        }
    }
</script>

<a style="display:inline-block; text-decoration:none" onclick="loadPage(1)" href="#">
    <img src="images/logo_facebook.png" target="_blank" style="display:inline-block;"/>
</a>

OR you can try

<a href="#" onclick="window.open('http://iphonedevlog.wordpress.com', '_blank', 'location=no');">
    without location bar
</a>
Andrew Lively
  • 2,145
  • 2
  • 20
  • 27
Umesh Panchani
  • 420
  • 3
  • 13
  • Thanks Andrew but i tried both and i keep geting the page open INSIDE the app. How do i get it open in the ios browser (safari or wahtever) ? – Travis Oct 03 '13 at 15:20
  • @Travis umesh was the one that answered your question, I simply edited his answer to make what he was saying clearer. I posted that this was a possible duplicate of this one: http://stackoverflow.com/questions/17887348/phonegap-open-link-in-browser. Have you checked out the link I posted earlier yet? – Andrew Lively Oct 03 '13 at 16:38
  • Yes i did. This is what is get: This open the page INSIDE the APP: LINK – Travis Oct 05 '13 at 10:18
  • And This dosen't really do nything ... :( LINK – Travis Oct 05 '13 at 10:18