Reputation: 2551
I have the following index.html: http://jsfiddle.net/fxyfwv8L/ Notice that I use the Facebook SDK initialization along with the jQuery Face Detection one. For some reason, these two are conflicting and throw some exceptions such as:
(index):1 Uncaught SyntaxError: Unexpected token _
(index):1 Uncaught SyntaxError: Unexpected token _
These seem to be generated by a JSON parse(), but I'm not able to understand why and how the FB SDK and jQuery Face Detection conflict.
A live demo is available here: http://stormy-river-6729.herokuapp.com/ (make sure to check the JavaScript console).
Upvotes: 4
Views: 4724
Reputation: 6406
The error is coming from line 16512 in the jquery.facedetection.js
file.
var data = "string" == typeof event.data ? JSON.parse(event.data) : event.data, scope = {
It happens because event.data
is set in the format key=value
and not as a JSON item.
To solve this add code of the format
try {
JSON.parse(event.data)
}
catch (e){
}
To catch the parsing error if it happens.
Upvotes: 4