Opening all external links in Phongap's ChildBrowser using jQuery Mobile

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2011-02-24T07:32:03Z Indexed on 2011/02/24 15:25 UTC
Read the original article Hit count: 192

Filed under:
|

I'm using jQuery Mobile & Phonegap, and have the following code to open all external links in a certain div with the ChildBrowser:

$('.someDIV a').live('click', function() { 
    var thisUrl = $(this).attr('href'); 
    PhoneGap.exec("ChildBrowserCommand.showWebPage", thisUrl); 
    return false; 
}); 

For some reason, while the page loads in the childbrowser, it also loads in the background, as if there's no "return false".

I've found a workaround by giving the link's href attribute a value of "#", and using the title for the url like this: And updating the jQuery code accordingly, but this is a problem where my links are dynamically generated, and I can't have the url in the title attribute.

Any ideas how to solve this?

© Stack Overflow or respective owner

Related posts about phonegap

Related posts about jquery-mobile