You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by daviesd <da...@oclc.org> on 2011/10/26 19:57:00 UTC

document.write

I¹m having something strange happen.  If I use document.write in my gadget
it seems to have issues loading

http://locahost:8080/opensocial/gadgets/ifr?url=...

It just spins and spins (I see 2 ifr requests one after the other, one
succeeds the other spins ‹ the gadget renders but there is an outstanding
network request).

Here¹s my code

            var params = {};
            params[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.TEXT;
            gadgets.io.makeRequest(url, function(result) {
                document.write('gadgets.io: ' + result.errors);
            }, params);
 
If I remove the document.write or just switch it to an alert it works fine.

Ideas?

Doug


Re: document.write

Posted by Dan Dumont <dd...@us.ibm.com>.
That would do it.   If you reparent an iframe it forces it to reload. Very 
annoying, as dojo and many other applications re-parent menu contents and 
other things when they are not visible ( I think for a11y reasons).  This 
causes gadgets that may exist in these areas to reload.   Kind of a crappy 
situation.  I think every browser behaves like this, even if the iframe 
element is inserted back into the dom it was originally from.  (This 
happens under the covers by just moving the iframe within the dom 
structure)

If possible, it would be good to set up your chrome before the render. 
Maybe when constructing the gadget-site if you are using the 
CommonContainer.



From:   daviesd <da...@oclc.org>
To:     <de...@shindig.apache.org>, 
Date:   10/26/2011 04:18 PM
Subject:        Re: document.write



Ya, so what I was doing was kind of backwards.  I called navigateGadget 
and
then tried to wrap the iframe node with my chrome.  I was using the YUI 
Node
wrap method, but I think it clones the node, thus my 2 iframe calls.  I am
now wrapping the element I pass to navigateSite BEFORE the call and then
looking for that DIV and decorating it with the chrome.

Thanks,
doug


On 10/26/11 3:42 PM, "Dan Dumont" <dd...@us.ibm.com> wrote:

> Could you share more of your current gadget minus the document.write?
> 
> Maybe put it on http://pastebin.com/ so we can try loading it locally?
> 
> 
> 
> From:   daviesd <da...@oclc.org>
> To:     shindig <de...@shindig.apache.org>,
> Date:   10/26/2011 03:00 PM
> Subject:        Re: document.write
> 
> 
> 
> I apologize.  It has nothing to do with document.write (I thought this 
was
> the culprit, but it just made it more visible in the browser).  I see 
this
> double ifr request even if my gadget does NOTHING (other than stub out a
> default view).  Ideas why I would see the ifr request twice?
> 
> doug
> 
> 
> On 10/26/11 1:57 PM, "daviesd" <da...@oclc.org> wrote:
> 
>> I¹m having something strange happen.  If I use document.write in my
> gadget it
>> seems to have issues loading
>> 
>> http://locahost:8080/opensocial/gadgets/ifr?url=...
>> 
>> It just spins and spins (I see 2 ifr requests one after the other, one
>> succeeds the other spins ‹ the gadget renders but there is an
> outstanding
>> network request).
>> 
>> Here¹s my code
>> 
>>             var params = {};
>>             params[gadgets.io.RequestParameters.CONTENT_TYPE] =
>> gadgets.io.ContentType.TEXT;
>>             gadgets.io.makeRequest(url, function(result) {
>>                 document.write('gadgets.io: ' + result.errors);
>>             }, params);
>> 
>> If I remove the document.write or just switch it to an alert it works
> fine.
>> 
>> Ideas?
>> 
>> Doug
> 
> 
> 
> 






Re: document.write

Posted by daviesd <da...@oclc.org>.
Ya, so what I was doing was kind of backwards.  I called navigateGadget and
then tried to wrap the iframe node with my chrome.  I was using the YUI Node
wrap method, but I think it clones the node, thus my 2 iframe calls.  I am
now wrapping the element I pass to navigateSite BEFORE the call and then
looking for that DIV and decorating it with the chrome.

Thanks,
doug


On 10/26/11 3:42 PM, "Dan Dumont" <dd...@us.ibm.com> wrote:

> Could you share more of your current gadget minus the document.write?
> 
> Maybe put it on http://pastebin.com/ so we can try loading it locally?
> 
> 
> 
> From:   daviesd <da...@oclc.org>
> To:     shindig <de...@shindig.apache.org>,
> Date:   10/26/2011 03:00 PM
> Subject:        Re: document.write
> 
> 
> 
> I apologize.  It has nothing to do with document.write (I thought this was
> the culprit, but it just made it more visible in the browser).  I see this
> double ifr request even if my gadget does NOTHING (other than stub out a
> default view).  Ideas why I would see the ifr request twice?
> 
> doug
> 
> 
> On 10/26/11 1:57 PM, "daviesd" <da...@oclc.org> wrote:
> 
>> I¹m having something strange happen.  If I use document.write in my
> gadget it
>> seems to have issues loading
>> 
>> http://locahost:8080/opensocial/gadgets/ifr?url=...
>> 
>> It just spins and spins (I see 2 ifr requests one after the other, one
>> succeeds the other spins ‹ the gadget renders but there is an
> outstanding
>> network request).
>> 
>> Here¹s my code
>> 
>>             var params = {};
>>             params[gadgets.io.RequestParameters.CONTENT_TYPE] =
>> gadgets.io.ContentType.TEXT;
>>             gadgets.io.makeRequest(url, function(result) {
>>                 document.write('gadgets.io: ' + result.errors);
>>             }, params);
>> 
>> If I remove the document.write or just switch it to an alert it works
> fine.
>> 
>> Ideas?
>> 
>> Doug
> 
> 
> 
> 



Re: document.write

Posted by Dan Dumont <dd...@us.ibm.com>.
Could you share more of your current gadget minus the document.write?

Maybe put it on http://pastebin.com/ so we can try loading it locally?



From:   daviesd <da...@oclc.org>
To:     shindig <de...@shindig.apache.org>, 
Date:   10/26/2011 03:00 PM
Subject:        Re: document.write



I apologize.  It has nothing to do with document.write (I thought this was
the culprit, but it just made it more visible in the browser).  I see this
double ifr request even if my gadget does NOTHING (other than stub out a
default view).  Ideas why I would see the ifr request twice?

doug


On 10/26/11 1:57 PM, "daviesd" <da...@oclc.org> wrote:

> I¹m having something strange happen.  If I use document.write in my 
gadget it
> seems to have issues loading
> 
> http://locahost:8080/opensocial/gadgets/ifr?url=...
> 
> It just spins and spins (I see 2 ifr requests one after the other, one
> succeeds the other spins ‹ the gadget renders but there is an 
outstanding
> network request).
> 
> Here¹s my code
> 
>             var params = {};
>             params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> gadgets.io.ContentType.TEXT;
>             gadgets.io.makeRequest(url, function(result) {
>                 document.write('gadgets.io: ' + result.errors);
>             }, params);
> 
> If I remove the document.write or just switch it to an alert it works 
fine.
> 
> Ideas?
> 
> Doug





Re: document.write

Posted by daviesd <da...@oclc.org>.
Ok, I¹m just gonna go home and crawl under a rock.  Turns out it was the
chrome I put around my gadget.  It does some DOM manipulation to wrap it,
which I think is causing the iframe to render again.  My bad!  Sorry.

doug


On 10/26/11 2:17 PM, "daviesd" <da...@oclc.org> wrote:

> I apologize.  It has nothing to do with document.write (I thought this was the
> culprit, but it just made it more visible in the browser).  I see this double
> ifr request even if my gadget does NOTHING (other than stub out a default
> view).  Ideas why I would see the ifr request twice?
> 
> doug
> 
> 
> On 10/26/11 1:57 PM, "daviesd" <da...@oclc.org> wrote:
> 
>> I¹m having something strange happen.  If I use document.write in my gadget it
>> seems to have issues loading
>> 
>> http://locahost:8080/opensocial/gadgets/ifr?url=...
>> 
>> It just spins and spins (I see 2 ifr requests one after the other, one
>> succeeds the other spins ‹ the gadget renders but there is an outstanding
>> network request).
>> 
>> Here¹s my code
>> 
>>             var params = {};
>>             params[gadgets.io.RequestParameters.CONTENT_TYPE] =
>> gadgets.io.ContentType.TEXT;
>>             gadgets.io.makeRequest(url, function(result) {
>>                 document.write('gadgets.io: ' + result.errors);
>>             }, params);
>>  
>> If I remove the document.write or just switch it to an alert it works fine.
>> 
>> Ideas?
>> 
>> Doug


Re: document.write

Posted by daviesd <da...@oclc.org>.
I apologize.  It has nothing to do with document.write (I thought this was
the culprit, but it just made it more visible in the browser).  I see this
double ifr request even if my gadget does NOTHING (other than stub out a
default view).  Ideas why I would see the ifr request twice?

doug


On 10/26/11 1:57 PM, "daviesd" <da...@oclc.org> wrote:

> I¹m having something strange happen.  If I use document.write in my gadget it
> seems to have issues loading
> 
> http://locahost:8080/opensocial/gadgets/ifr?url=...
> 
> It just spins and spins (I see 2 ifr requests one after the other, one
> succeeds the other spins ‹ the gadget renders but there is an outstanding
> network request).
> 
> Here¹s my code
> 
>             var params = {};
>             params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> gadgets.io.ContentType.TEXT;
>             gadgets.io.makeRequest(url, function(result) {
>                 document.write('gadgets.io: ' + result.errors);
>             }, params);
>  
> If I remove the document.write or just switch it to an alert it works fine.
> 
> Ideas?
> 
> Doug