Feb 5, 2015

Use MozActivity to launch a page

In Firefox OS, you can use MozActivity to launch browser with a specific URL like this:
 
var url = 'http://mozilla.org';
new MozActivity({
  name: 'view',
  data: { type: 'url', url: url }
});

We can listen the event 'appterminated' to know when the browser is killed, and e.detail.origin can tell you which browser is.
 
window.addEventListener('appterminated', function (e) {
  if (e.detail.origin === url) {
    console.log('Ooh, it's killed.');
  }
});

You may want to know,will e.detail.origin be changed if we change the url during browsing the page?
The answer is NO.

Even you browse the page from mozilla.org to www.yahoo.com , e.detail.origin still won't be change.

1 comment:

ignacehaddon said...

Casino - JTG Hub
Join JTG in 군산 출장샵 our casino 군포 출장마사지 to play your favorite casino games! Experience the thrills of the slots and 의왕 출장마사지 table games of 포천 출장샵 JTG, the 제주도 출장마사지 leader of the casino industry.