homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Firefox 6.0 Dynamic Content Limitations

 5:26 pm on Aug 31, 2011 (gmt 0)

Hi everybody!

I am experiencing a few strange responses from FF (incredibly!) when it's about loading dynamic content. Everything works well on IE7, Opera and Chrome. The page I am talking about is this one:


I developed a platform where users can add pieces of stories to a starting situation using AJAX. Everything works well but in one of these stories which has a huge number of contributions the content won't be displayed in FF.

At the beginning I though it was some strange character inserted and so I changed the content to a dummy string. No changes. Then I deleted the last contribution and the page was displayed correctly. When adding a new entry, independently from what I write, it won't display the content, even though it is correctly loaded from an XML file as one can see using Firebug in the variable xhr. I wonder if there are memory limits or something like this in FF. Otherwise I can't understand why it is not working.

Any help is really welcome!



 6:19 pm on Aug 31, 2011 (gmt 0)

Stepping through the code with Firebug, I could see that your script seems to be stopping on this line:

var tmp= eval('(' + fromJSON + ')');

Inspecting the value of fromJSON, it would seem to contain an invalid JSON string. I count 100 opening braces { in the string, but only 78 closing braces }.

I would start there.


 6:54 pm on Aug 31, 2011 (gmt 0)

A bit ironic that you have "... works better with Mozilla Firefox"! ;) (I must say, I think it's a great site btw. I've had a very similar site idea mulling over in the back of my head for a while... and you've gone and made it! ;)


 7:18 pm on Aug 31, 2011 (gmt 0)

Hey guys, thanks for your help!

You are right, but if it were a JSON error also the other browsers should fail... Or not? I can't really figure out why so few closed brackets while in the XML file that generates the JSON they are all there (http://www.lyra.it/storybroad/storiesToXML.php?storyId=5 last tag before the end). Could it be that the JSON is truncated in FF after a certain length? I checked online and didn't find anything about it...

It is ironic indeed. I'd like to solve this problem so that I don't have to remove that caption :) Thanks for the compliments, waiting for your clouds!


 1:05 am on Sep 1, 2011 (gmt 0)

The problem seems to be here:

fromJSON = tmp[0].firstChild.nodeValue;

Inspecting tmp[0].firstChild shows a "wholeText" property that contains 100 closing braces as well, but the nodeValue seems to only contain 78. Looking more closely, tmp[0].firstChild has 2 child nodes, both of which are TextNode, the second of which has all of the remaining braces. The first has a length of 4096, so I wonder if the browser is just chunking the data. So instead of taking tmp[0].firstChild.nodeValue, you may need to iterate over tmp[0].firstChild.childNodes and concatenate all of the nodeValues.

Something like this:

var i;
fromJSON = "";
for (i = 0; i < tmp[0].firstChild.childNodes.length; i++) {
fromJSON += tmp[0].firstChild.childNodes[i].nodeValue;


 7:39 am on Sep 1, 2011 (gmt 0)

The first has a length of 4096, so I wonder if the browser is just chunking the data.

Interesting, FF has always had a 'problem' with a limit on the size of its TextNodes.
Sep 15, 2006 - problems when get nodeValue by Firefox . Help me plzz! [webmasterworld.com]
Jul 6, 2007 - Size limit of 4K for textarea in Moz/FF from xmlhttprequest? [webmasterworld.com]


 7:51 am on Sep 1, 2011 (gmt 0)

Hate to be a fuddy duddy, but with NoScript installed, can't use the site anyway! And I don't (general principles). Doubt I'm in the few...

Just something to think about.

My IE is ratcheted down just as tight.

Might be a "small" part of the web these days, but that number is growing. Might suggest a rethink on presentation of content?


 8:51 am on Sep 1, 2011 (gmt 0)

Fotiman, don't know how to thank you (a virtual coffee? :)), that was the right idea!

var i;
fromJSON = "";
for (i = 0; i < tmp[0].childNodes.length; i++) {
fromJSON += tmp[0].childNodes[i].nodeValue;

And thanks to Penders we have a possible theoretical explanation to the problem.

Tangor, could it be that you tried the platform when I was doing modifications to the code?

Thanks to everybody!


 2:31 am on Sep 2, 2011 (gmt 0)

Might have, but this is what I got today:

Your javascript is disabled. Please enable it or use a browser that supports client-side scripting. Try again

And, as stated previous, I rarely opt to activate it. :)


 7:26 am on Sep 2, 2011 (gmt 0)

Sorry Tangor, I misunderstood what you wanted to say. Well, I have honestly no idea about how to implement the same dynamic behavior without JS. I could use Flash but it would be a tremendous effort...


 4:27 pm on Sep 2, 2011 (gmt 0)

This is true, but I do have a query, is there no graceful way to drop to html if visitor has js disabled? Not quite sure the numbers out there, but is a fair chunk of potential visitors. At this point, I can't even see what the site is about... and that's a real concern for some visitors.


 4:52 pm on Sep 2, 2011 (gmt 0)

I see your point and you are right. Thanks for the advice. I will think of something, at least a link to the non-AJAX page that lists the published stories.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved