Open link into browser and not in a web view

4,537 views
Skip to first unread message

ziobudda@gmail

unread,
Feb 10, 2012, 5:58:55 PM2/10/12
to phon...@googlegroups.com
Hi all. I have my ios app (phonegap + jquerytmobile 1.0)  that has some link that point to the online site version.
For the moment I have used childbrowser plugin, but I have a problem with google maps and the about:blank childbrowser problem.

So: how can I create a html LINK that open safari ? Because if I remove childbrowser plugin all external link are open (I think) into a new webview inside my application, but without the possibility to return to the previously page.

Thanks.

M.

--
Michel 'ZioBudda' Morelli                       mic...@ziobuddalabs.it
Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax)
0200619074 - 3939890025 (mobile)--  Fax: +39-0291390660
http://www.ziobuddalabs.it                      Skype: zio_budda

Aater Suleman

unread,
Feb 10, 2012, 7:03:20 PM2/10/12
to phonegap
What have you set the external hosts to in the phonegap.xml file. What
is the current value there?

Devgeeks

unread,
Feb 10, 2012, 7:18:18 PM2/10/12
to phon...@googlegroups.com
I don't know much about ChildBrowser, but try opening the link via JavaScript (after adding the external host to the ExternalHosts in PhoneGap.plist):

<script type="text/javascript">
    function external_link(anchor) {
        window.location = anchor.href;
    }
</script>
<a href="http://mysite.com/yadda.html" onclick="external_link(this)">My Site</a>

Devgeeks

unread,
Feb 10, 2012, 7:19:26 PM2/10/12
to phon...@googlegroups.com
oops... might wanna return false there.... 

I usually use jQuery so I am clumsy with 'pure' JavaScript ;)

<script type="text/javascript">
   function external_link(anchor) {
       window.location = anchor.href;
   }
</script>
<a href="http://mysite.com/yadda.html" onclick="external_link(this);return false;">My Site</a>

ziobudda@gmail

unread,
Feb 10, 2012, 8:02:00 PM2/10/12
to phon...@googlegroups.com
Il giorno 11/feb/2012, alle ore 01:03, Aater Suleman ha scritto:

What have you set the external hosts to in the phonegap.xml file. What
is the current value there?

Wait, I think that I need to write some other things.

My app works: I  get some ajax data from the server, childbrowser works when I click on a Link, but my problem is with google maps and childbrowser: an empty page (about:blank) is called when my app "exec" 

$('#come_arrivare2').live('pageshow',function (event,ui) {
                                           //event.preventDefault();
                                            navigator.geolocation.getCurrentPosition(storePosition, errorgeo);
                                            //navigator.geolocation.getCurrentPosition(storePosition, errorgeo,{ maximumAge:1000,timeout:3000,enableHighAccuracy: false });
                                           return false;
                                           });


And only the first time. 

So, to remove the problem I think that I could open my links into an external safari browser, but how ? 

M.
--
Michel 'ZioBudda' Morelli                       mic...@ziobuddalabs.it
Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax)

Devgeeks

unread,
Feb 11, 2012, 8:21:12 AM2/11/12
to phon...@googlegroups.com
My answer was to open the links in the external browser...

Kerri Shotts

unread,
Feb 11, 2012, 4:02:33 PM2/11/12
to phon...@googlegroups.com
Does adding target="_blank" do anything? 

skybondsor

unread,
Feb 13, 2012, 4:58:36 PM2/13/12
to phonegap
target="_blank" worked for me!

cau jonny

unread,
Apr 26, 2012, 4:50:43 AM4/26/12
to phon...@googlegroups.com
hi, I got the same problem, so I tryed  your solutions but I haven't seen the this result, infact don't open safari with the link. Do you try o modded this your code?
bye

Il giorno lunedì 13 febbraio 2012 22:58:36 UTC+1, skybondsor ha scritto:
target="_blank" worked for me!
Reply all
Reply to author
Forward
0 new messages