ARV
ARV

Reputation: 405

Open a web link with in the app itself in jquery mobile

I want to open a url(ex. www.google.com) in jquery mobile android app. I want to open it with in the context of the app itself. i dont want to open a diffrent browser to launch it on the click of the link or button. i want to open it with in the app. is it possible. Thanks.

Upvotes: 1

Views: 2200

Answers (1)

daniel.auener
daniel.auener

Reputation: 1294

Found the solution here:

function openInWebView(url)
{
    var anchor = document.createElement('a');
    anchor.setAttribute('href', url);

    var dispatch = document.createEvent('HTMLEvents')
    dispatch.initEvent('click', true, true);

    anchor.dispatchEvent(dispatch);
}

Then call the function like this in your app:

openInWebView('http://google.com')

Upvotes: 1

Related Questions