Phil,
Thanks for the response. I was able to get an RPC version of the solution to
make the call transparently as well, but the reality is that response is the
problem not the transparency on the initial call.
The initial call with Ajax.Updater is transparent. The call is made from the
same domain (so it is tolerated), but the Ajax.updater calls the FBAPI from
the server. Facebook then receives the request and then generates session
specific HTML, iframes, and javascript that is returned in the response.
When the response is pushed into the div by Ajax.updater it is rendered by
the browser causing the second set of calls to Facebook. These are the calls
that are foiled by encountering a corporate firewall.
When I look at the network traffic of the initial call, the browser is not
registering that Ajax.updater is in fact loading and executing Javascript
that calls Facebook's API. The only thing that the browser registers is the
response code which unfortunately makes subsequent calls to Facebook. The
failure is when that response has Javascript and iframes that make more
Facebook calls.
I was thinking nesting Ajax.updater calls might work, but my analysis of the
resulting problem was that Ajax.updater being asynchronous was not waiting
around for the nested call to complete.
I was thinking that one approach would be to replace the Ajax.updater call
in the Index.html with an Ajax.request.
Instead of this:
<body onload="javascript:new Ajax.Updater('fbplugin','fbsidebar.html',{
method: 'PUT', evalScripts: 'false'});">
Something like
<body onload="javascript:
new Ajax.Request('fbsidebar.html', {
onSuccess: function(response) {
if (
// I don't know how to code this exactly, but we could look for 'facebook'
in the text of the response indicating it has truly completed
// I also will have to push this back into inner.html somehow so it gets
into the same div
}
});>
Where fbsidebar.html still makes the same Ajax.Updater requests:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
<http://www.google.com/url?sa=D&q=http://www.w3.org/TR/xhtml1/DTD/xhtml1-str
ict.dtd&usg=AFQjCNGyZvRlhcV5U74tS6HQEnjRAh3Y6w> ">
<html xmlns="http://www.w3.org/1999/xhtml
<http://www.google.com/url?sa=D&q=http://www.w3.org/1999/xhtml&usg=AFQjCNFx6
iI5yL1TV5v1Hh0NXafIXxp4uw> "
xmlns:fb="http://www.facebook.com/2008/fbml
<http://www.google.com/url?sa=D&q=http://www.facebook.com/2008/fbml&usg=AFQj
CNFzqxOSAd0ReoOSZ9Xr45iiBj8N1A> ">
<head>
<script type="text/javascript" src="js/prototype.js"></script>
</head>
<body onload="javascript:new
Ajax.Updater('fbloader','fbsidebarcall.html',{ method: 'PUT', evalScripts:
'true'});">
<div id="fbloader">
</div>
</body>
</html>
Making a subsequent call to fbsidebarcall.html which is the facebook plugin
call:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
<http://www.google.com/url?sa=D&q=http://www.w3.org/TR/xhtml1/DTD/xhtml1-str
ict.dtd&usg=AFQjCNGyZvRlhcV5U74tS6HQEnjRAh3Y6w> ">
<html xmlns="http://www.w3.org/1999/xhtml
<http://www.google.com/url?sa=D&q=http://www.w3.org/1999/xhtml&usg=AFQjCNFx6
iI5yL1TV5v1Hh0NXafIXxp4uw> "
xmlns:fb="http://www.facebook.com/2008/fbml
<http://www.google.com/url?sa=D&q=http://www.facebook.com/2008/fbml&usg=AFQj
CNFzqxOSAd0ReoOSZ9Xr45iiBj8N1A> ">
<head>
<body>
<div id="fb-root">
<fb:like-box profile_id="xxxxxxxx" connections="10" header="false"
style="background-color:white; border:none; overflow:hidden; width:300px;
height:575px;" allowTransparency="true"></fb:like-box>
<!--Facebook Javascript SDK-->
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'xxxxxxxxxx', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
</div>
</body>
</html>
Do you really think none of the Javascript is executing on the server?
From: [email protected]
[mailto:[email protected]] On Behalf Of Phil Petree
Sent: Thursday, September 16, 2010 1:43 PM
To: [email protected]
Subject: Re: [Proto-Scripty] Re: Nested Ajax.Updater
I've been thinking about this... kinda nagging at me in the back of my
mind...
Why not use AJAX to make a SOAP call? The SOAP call would make the call to
the fbapi completely transparent.
One article here:
http://www.ibm.com/developerworks/webservices/library/ws-wsajax/
On Thu, Sep 16, 2010 at 6:51 AM, ColinFine <[email protected]> wrote:
On Sep 15, 1:54 am, Ed Fullman <[email protected]> wrote:
> The file fbsidebar.html is a standard Facebook plugin as follows.
> I need fbsidebar.html to run on the server, and return only the rendered
> code. In this (current) configuration, the Ajax.updater in Index.html will
> return a bunch of iframes and javascript that make subsequent calls in the
> browser to Facebook domains encountering corporate firewalls.
AFAICS fbsidebar.html is HTML with Javascript embedded.
I don't think you can run Javascript on the server without a SSJS
system on the server: I've never heard of running it server-side in an
HTML page like a PHP program.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us <http://script.aculo.us/> " group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected]
<mailto:prototype-scriptaculous%[email protected]> .
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.