09-21-2011 12:15 PM
I'm having an issue integrating with Facebook and the Browserfield2.
Basically, what we do is we redirect the user to the Facebook login page with our tokens and the corresponding redirect URL.
When user posts the login credentials, two (Status=Found - 302) redirects occur and then a partial HTML page is returned to the user with the contents similar to this:
Notice that this is only the content sent back in that last page.
This works fine with other browsers like Firefox, etc...
Thanks in advance,
09-21-2011 12:59 PM
Have you tried wrapping HTML/HEAD/BODY tags around the content?
09-21-2011 01:16 PM
Thanks for replying.
Unfortunately, I don't control the HTML that comes back. It's coming directly from Facebook.
I thought about trying to get the raw HTML, extract the URL, and then perform the redirect using a Browserfield Listener or Controller, but I haven't found a way to do that. The document.getChildNodes() returns null.
09-21-2011 01:18 PM
Are you on the same origin?? could you do an ajax call, return the script and then eval() the contents?
09-21-2011 01:47 PM
I think I know what you mean, but I don't know how to get a hold of the raw content.
I've been looking at the two parameters passed to the BrowserFieldListener.documentLoaded(Browserfield, Document),but I don't see a way to get the text of the raw content with any of those parameters.
If you know way, please let me know and I can give it try.
09-21-2011 02:50 PM
09-21-2011 03:05 PM
Unfortunately, I don't have control of that page. The application I'm building uses WebWorks and the user navigates out of the starting page of Webworks app to the pages of an existing web site. That web site provides the options to login using Facebook.
I do have access to the Browserfield provided by WebWorks and could instantiate other Browserfield objects if needed to.
Is there any other way to make this work? Or get a hold of the HTML content returned?
09-21-2011 03:26 PM
I believe what you are looking for is at the bottom of this page:
09-21-2011 04:25 PM
Thanks fo the link, but that did not work for me.
The Document object provided by the BrowserField2 in WebWorks is of type:
This object does not appear to implement the HTMLDoc interface and I get Cast exceptions when I try to cast.
I've tried both org.w3c.dom.html.HTMLDoc (the webworks compile process does not allow it) and org.w3c.dom.html2.HTMLDoc.
Anything else I could try?
09-22-2011 07:25 AM
For the sake of simplicity.. let's call this API "foo.setText(string)"
In my extension, I would listen for the BrowserField loaded event and then I would run an "executeScript()" on the BrowserField object that would run the following code
This would fire my "setText" function on my "foo" extension and it wold have the whole document's content as a string.
Also, if you are going this route, make sure that if you pass a handle for the BrowserField into your extension, make sure you keep it as a weak reference so that you don't get any memory leaks.