Force open Facebook/Twitter/Google in browser

Asked

Viewed 280 times

-2

I created a mobile app that is accessed via browser (a web app, a common website).

In it I have a button that opens via window.open() a page on Facebook, but when I click the button, it calls the Facebook application. I need the page to open in the mobile browser itself.

I’ve tried window.open(url, '_system', 'Location=yes'), but it doesn’t work, I think it only works for installed apps.

Is there any solution?

  • Hi Paulo, is a web app, a website.

  • I just wanted to open a Facebook page in the Android browser itself, but when I click the button it asks if I want to open with the Facebook App or with the browser. I wanted to open directly with the browser, without asking. I wonder if?

1 answer

0

Try this,

HTML:

<div id="teste" data-href="http://www.google.com">Google</div>

Javascript:

document.getElementById("teste").addEventListener("click", function(evt) {
    var a = document.createElement('a');
    a.setAttribute("href", this.getAttribute("data-href"));
    a.setAttribute("target", "_blank");
    var dispatch = document.createEvent("HTMLEvents");
    dispatch.initEvent("click", true, true);
    a.dispatchEvent(dispatch);
}, false);

Anything put there.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.