Reputation: 4493
I want to open a link say www.google.com in Phonegap Android... I've tried lot of things but I'm not able to open any link.
<access origin="http://google.com" />
is already added to config.xml.
navigator.app.loadUrl('http://google.com');
is giving an error.
$('#pageID').load('http://google.com',function(){
$('#pageID').trigger('create');
});
is loading the page but the images are not displayed, which is required in my case.
Can anyone explain how to actually open a link in Phonegap.
Upvotes: 0
Views: 399
Reputation: 4493
Well it seems its not possible ..... but I found that we can do it other way round.
We know this works :-
<a data-role="none" id="someID" href="#" target="_blank">
So we can write jQuery as :-
$('#idAnchorTag').attr('href','some URL');
So the complete code is :- (Assuming that click was made on an image)
<a data-role="none" id="idAnchorTag" href="#" target="_blank">
<img id="idIMG" src="some IMAGE">
</a>
And the JS :-
$(function() {
$("#idIMG").click(function(){
$('#idAnchorTag').attr('href','some URL');
});
});
Upvotes: 1
Reputation: 3644
try
$('#pageID').onClick(function(){
document.location.href="http://google.com";
})
Upvotes: 0