Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a link in the default browser on Firefox OS?

Tags:

firefox-os

I have a Firefox OS app where I want a link to open outside of the application (the link is to a different site, and opening it in-application would make the application unusable without a force-quite). How do I do that?


Related bug report

like image 554
Brendan Long Avatar asked Sep 30 '13 01:09

Brendan Long


1 Answers

If you don't want to change all the links in the application, you can use WebActivities, e.g. like this:

/*
 * Open all external links in the browser
 */
$('a[href^=http]').click(function(e){
    e.preventDefault();

    var activity = new MozActivity({
    name: "view",
    data: {
              type: "url",
               url: $(this).attr("href")
          }
    });
 });
like image 78
rge Avatar answered Sep 28 '22 16:09

rge