Question

I am writting a firefox os application and I found a strange problem. I have two web activities (open a link on a projects tab and sending an e-mail on the users tab ) what are work correctly under the Firefox OS 1.1 simulator but not work under the appmanager+firefox OS 1.2 simulator. In additional it did not work under my Keon phone with FFOS 1.2 prerelease.

Do you have any idea? Thanks.

Was it helpful?

Solution

Might not be the most optimal way but try something like:

function sendEmail(toEmail, subject, body) {
  var createEmail = new MozActivity({
    name : "new",
    data : {
      type : "mail",
      url : "mailto:" + toEmail + "?&subject=" + subject + "&body=" + body + "",
    }
  });
}
function processUsers() {
    if (xhr.readyState == 4 && xhr.status == 200) {
      var obj = jQuery.parseJSON(xhr.responseText);
      for (var i = 0; i < obj['users'].length; i++) {
        if (obj['users'][i].email != null) {
            var myLi = document.createElement('li');
            myLi.innerHTML = "<p>" + obj['users'][i].name+ "</p>" + "<p class='sendEmail'>" + obj['users'][i].email; "</p>";
            var em =obj['users'][i].email;
            var sb = '';
            var bd = '';
            myLi.onclick = (function(em, sb, bd) {
                return function(){ sendEmail(em, sb, bd) }
            })(em, sb, bd);
          $('#resultsUsers').append(myLi);
        } else {
          $('#resultsUsers').append("<li><p>" + obj['users'][i].name + "</p></li>");
        }
      }
      usersAreLoaded = true;
    } else {
      console.log("did not get data " + xhr.status);
    }
}

OTHER TIPS

Inline JavaScript code inside onclick etc will not run in privileged apps, see the docs about app CSP (content security policy):

Inline scripts are banned. You may not use script attributes like onclick="" or onload="".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top