[JavaScript] How to make a Javascript prompt dialog post to PHP
Most providers who allow developers to embed JavaScript within their domain force developers to use IFrames to sandbox their code. Facebook has taken a different approach to this problem. JavaScript that you give us gets parsed, and any identifiers (function and variable names) get prepended with your application ID. For example, the following code block:
function foo(bar) {
var obj = {property: bar};
return obj.property;
}
becomes:
function a12345_foo(a12345_bar) {
var a12345_obj = {property: a12345_bar};
return a12345_obj.property;
}
This creates a virtual scope for every application that runs within Facebook. From there we expose certain functionality through a collection of JavaScript objects that allow you to modify your content on Facebook. Our objects are made to mimic the functionality of JavaScript as closely as possible, but it may take some getting used to for people who are already adept with JavaScript.
function foo(bar) {
var obj = {property: bar};
return obj.property;
}
becomes:
function a12345_foo(a12345_bar) {
var a12345_obj = {property: a12345_bar};
return a12345_obj.property;
}
This creates a virtual scope for every application that runs within Facebook. From there we expose certain functionality through a collection of JavaScript objects that allow you to modify your content on Facebook. Our objects are made to mimic the functionality of JavaScript as closely as possible, but it may take some getting used to for people who are already adept with JavaScript.
Labels: Tricks
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home