Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Student want to dev on fireFox OS but have error ! Can you help me please !

18 views
Skip to first unread message

Tiến Trần

unread,
May 13, 2013, 8:39:52 AM5/13/13
to
Hi everyone.
I'm Tien.
Iim student. I want to dev on fireFox Os. But i have some problems when i coding.
please help me :(

my problems:
I try to add a contact using contactAPI.
code on fireFox web.
but it not run.
//------------------ Code -----------
// HTML FILE
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
<script>
function addcontact()
{
var person = new Contact();
alert(" RUN ON HERE");
// My app not show it. :( so i think "new Contact()" not support
person.givenName = "John";
person.familyName = "Doe";
person.nickName = "No kidding";
var saving = navigator.mozContacts.save(person);
saving.onsuccess = function () {
console.log('new contact saved');
// This update the person as it is stored
// It includes it's internal unique ID
person = saving.result;
}
saving.onerror = function (err) {
console.error(err);
}
}
</script>
</head>
<body>
<input type ='button' onclick ="addcontact()" value="add contact"/>
</body>
</html>

//------------manifest.webapp-----------
{
"version": "0.1",
"name": " T-Contact",
"description": "manage contact",
"launch_path": "/index.html",
"appcache_path": "/offline.appcache",
"icons": {
"32": "a32.png"
},
"developer": {
"name": "Tran Tien",
"url": ""
},
"installs_allowed_from": ["*"],
"default_locale": "en",
"permissions": {
"systemXHR": {}
}
}

Salvador de la Puente González

unread,
May 13, 2013, 12:14:27 PM5/13/13
to Tiến Trần, dev-w...@lists.mozilla.org
Hello Tiến

First you need the permission for Contacts. I don't know why are you using the "systemXHR" permission instead. I recommend you to read [1].
Second, if you're using the Contacts API, you will need to be a privileged application, so specify in "type": "privileged" or see the documentation on [1] again.

I think you are unable to create a new Contact because you don't have the proper permission.

[1] https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest

Hope it helps.
Kind regards.
_______________________________________________
dev-webapi mailing list
dev-w...@lists.mozilla.org<mailto:dev-w...@lists.mozilla.org>
https://lists.mozilla.org/listinfo/dev-webapi





________________________________

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at:
http://www.tid.es/ES/PAGINAS/disclaimer.aspx

Tiến Trần

unread,
May 13, 2013, 12:41:23 PM5/13/13
to
Thank you. link you provide. it is useful

I try modify manifest.webapp file. I test app on simulator FF OS . But it not run.
//
{
"version": "0.1",
"name": " T-Contact",
"description": "manage contact",
"launch_path": "/index.html",
"appcache_path": "/offline.appcache",
"icons": {
"32": "a32.png"
},
"developer": {
"name": "Tran Tien",
"url": ""
},
"installs_allowed_from": ["*"],
"default_locale": "en",
"permissions": {
"contacts": {
"description": "Required for autocompletion in the share screen",
"access": "readcreate"
}
},
"type": "privileged"
}

Salvador de la Puente González

unread,
May 13, 2013, 2:43:03 PM5/13/13
to Tiến Trần, dev-w...@lists.mozilla.org
Can you provide some more info, please? A trace from the Console would
be great.
> _______________________________________________
> dev-webapi mailing list
> dev-w...@lists.mozilla.org

Tiến Trần

unread,
May 13, 2013, 10:00:20 PM5/13/13
to

JOSE MANUEL CANTERA FONSECA

unread,
May 14, 2013, 4:44:45 AM5/14/13
to Tiến Trần, dev-w...@lists.mozilla.org
You are violating CSP. Please move script code from HTML to a JS file

best

El 13/05/13 14:39, "Tiến Trần" <trant...@gmail.com> escribió:

Tiến Trần

unread,
May 14, 2013, 10:11:21 AM5/14/13
to
i moved script to js file. But contact not add.
can you help me on teamviewer? plz
0 new messages