views:

42

answers:

2

is there any downside to add content text through javascript other than it will not shown when if javascrit is disabled?

for example like this http://stackoverflow.com/questions/1899913/how-to-detect-linked-pdf-on-a-page-and-show-message-to-download-adobe-reader-usin/1899938#1899938

if text will not shown to javascript disabled use, no problem and i don't need this text for search engine.

Will it affect to page performance to end user?

+1  A: 

Depending on how you actually implement this, you will either have to wait until the documents finishes loading the element you are trying to modify, or (and probably worse) your page will stop loading/rendering until you finish writing your content.

Esteban Araya
$(document).ready executes after the page is fully loaded, so jquery will not cause the page to stop rendering in this case.
jspcal
+1  A: 

i think if it saves you time, sure do it.

in most cases, the differences would be negligible. theoretically you could be dealing with more js compatibility issues, more debugging of js, slight flicker on the page as elements are re-arranged, but then again, those issues may never happen.

jspcal
Have you ever added an Omniture tracking pixel with document.write? It is *sloooooow*. You definitely want to modify your DOM wisely.
Esteban Araya
js tracking codes aren't supposed to delay page rendering. if so, it's a bug. in any case, it's just as ez to add on the server-side. jquery wouldn't really save any time.
jspcal