View Full Version : no linebreak when inserting text with JS (fixed div weight)

09-25-2012, 12:40 PM

I got a JS script (not coded by me) which loads the tweets from twitter and insert the tweet after some seconds into the page. The problem is, that if you click on "show quellcode" in your browser the text is NOT displayed in the normal html & css stuff you get from the browser.

The text is displayed after ~ 2 seconds and even if I define the width of the div container the text is inside the text does not breaks after the defined width but just is in 1 line until infinity :-(

If you need some code please tell me which part - (the text-displaying part?) I dont know much of JS but just use sometime some ready scripts of other developer - I only code PHP, JAVA, C++ :-/

THanks in advance if someone replys and try to help me =/

09-25-2012, 12:50 PM
Yes, of course JS generated code is not shown in the output source code because it is generated dynamically by the browser after the hard coded HTML has been created. You can see the HTML generated by JS by using the developer console that is included in most browsers, or with Firebug which is a Firefox extension.

The best would be if you posted a link to a live example demonstrating the problem.

09-25-2012, 01:14 PM
Hi Stephan,
thank for your fast reply.

This is the project I'm working on:

at the nearly-bottom there is "lastest tweets" and after some seconds the overflowed text is displayed.


09-25-2012, 02:03 PM
“Lates Tweets” isn’t showing anything for me, because:

[NoScript] Blocking nosniff Javascript served from https://raw.github.com/remy/twitterlib/master/twitterlib.js with wrong type info text/plain, inline and included by http://www.officerulz.com.au/

Obviously that twitter script is pulling another file from GitHub, and with the wrong MIME type. You would probably be better off downloading that script directly, hosting it yourself, and changing the file path in http://www.officerulz.com.au/twitter/src/twitter2.js on line 230, because I’ve read somewhere that IE 9 will also block scripts that are included this way.

09-25-2012, 02:19 PM
Thanks for the information Stephan, I've linked it as you suggested.

Can you see it now?

[I'm off the computer, thus I'll answer tomorrow morning.]
Thanks in advance for the help :)

09-25-2012, 02:46 PM
Yes, I see it now. For the line wrapping remove line 15 in http://www.officerulz.com.au/twitter/twitter.css which is explicitly telling the HTML to not wrap on whitespaces.

09-26-2012, 12:13 AM
Wow, thanks mate !!
[It works]

If you don't understand a coding language you think the problem MUST be the language thus I didn't looked into the css :-/

Thanks you very very much for having a look into the code :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum