Why? Aren't extensions for GM4HTML5 executed in the exact same window as the game itself? AFAICS the only thing you'd need to do is store the value in a global variable.
You are probably right.

I've only used javascript sparingly before, so with GM:HTML5 I'm learning as I go along. The html content swapping was the first method I stumbled upon of sending a variable that worked with async javascript, so I latched onto it for dear life.
I found it a difficult read as well, but it does seem to provide the required information... One way to pass variables back and forth, as the documentation for server-side authentication notes, is by passing the values you need to keep track of in the redirect URI. So basically you're sending the values off to Facebook, and Facebook kindly sends them back for you to pick up from the URL parameters. The latter can be done both on the server and in a browser. In fact, for server-side authentication you MUST pass something like a session ID back and forth so you know which session has just been authenticated.
All of that is true (except for the part about the facebook documentation providing the required information...I'd dispute that.

), but that's not the issue that I ran into. I was using the pay dialog method of FB, for which the URL parameter method usually works, but with GM there is an added layer of communication. It goes like this:
(1: GM) -> (2: JS) -> (3: PHP) -> (4: FB) -> (5: PHP) -> (6: JS) -> (7: GM)
(1) to (2) to (3) is trivial. The issue comes in at (3) to (4) where PHP calls FB. FB creates a pay dialog with asynchronous JS, meaning that the rest of the code continues. Without waiting for (4), steps (5) to (6) to (7) occur. At this point, as far as GM is concerned, the function call that started this chain of communication is finished.
The FB dialog initiates a new JS script after the user responds on the dialog, which normally works just fine. But in the case of GM:HTML5, this new JS code has no simple way of passing the info back to GM - hence the need for polling.
We've come up with a nice way to allow "call backs" into the engine, this will let you do async stuff in extensions and then basically throw normal GameMaker events (I'd suggest user events). We'll have to test, but it should be fine.... Not sure when it'll go in, but it'll avoid all the polling.
If I understand you correctly, Mike, this would not eliminate the need for polling in this example. FB dialog communication is a two-step deal: A function first tells facebook that it needs to show a certain dialog, and then ends. FB then calls back to a file on the server with the information that the user entered into the dialog for you to do whatever you need with it. The problem is that the server can't initiate communication with GM - so as far as I can tell GM still has to constantly poll.