Google and JS...?

coolwaves4all

New Member
Hi all...I heard that it's important for the ranking/indexing in google- to take off the JS code from the HTML and make it external .JS file. Is it true? Why should it matter? I guessed that google knows how to handle Js codes...I have about 30-40 lines of JS in most of pages, how to make it external Js file?Thanks in advance,Guy.http://www.javascripter.net/faq/externa2.htmThat tells you how to make an external js file.Thanks Jess, I just your other massage.. Anyway, there is any problem for google to read Js? and even if not, what is the best way (and why...) to run JS in a website, externally?Thanks for all, I love this forum... !Guy.CSS and javascripts in separate files means:You get your text closer to the beginning of the page, the robot doesn't have to wade through lot's of CSS, Javascript and HTML-code to find your content.Thats pretty much the extent of it. I find its good practice to just put javascript code into a js file and link to it, it keeps the code looking a lot cleaner also.Another advantage of externalising JS is it reduces the page load time, that is if you use the same JS in multiple pages, which is very common. the browser loads the JS file only once. saving that number of bytes per web page.There is a gotcha about JS you should be aware of cdx.if you use JS to "create" your page content then a search engine spider will ignore it, and your page won't get indexed(in other words your JS has lots of document.print("page content text") statements)So use JS to give your page functionality not contentAnother bonus is when you want to update the js or css code you only have to do it in one place...not on every page....probably the biggest plus since most common js and css code is not very long it won't affect the size of the page too much and JS doesn't always have to be at the top of the page...just before the event that calls it.Better for "slimming" your site. Having a reference file is a lot easier. And as others have stated, it will reduce load time and you only have to update one place should you need to.
 
Back
Top