Should we use External or Internal Javascript in Blogspot for Better SEO?


#1

I would like to ask a question related to Javascript/Jequery Integration in Blogger Site.

Lets come to the point,

I am using Pagination Scripts in my site www.templatezy.com that is hosted on google drive.

I did this because the script code is too lengthy, thus i simply hosted it on google drive and put the link back into the template.

Is the pagination script same in the eyes of robot ?..respectively 1 Hosted, 2 inside template.

<!--Page Navigation Starts-->
<script type='text/javascript'> var pageCount=9; var displayPageNum=1; var upPageWord ='NEW'; var downPageWord ='NEXT'; 
</script>
<script src='https://googledrive.com/host/0B4KX4FgBpp0Gdk05U0psaWRtbWc' type='text/javascript'></script>
<!--Page Navigation Ends -->
<script>

Should i use the same or replace the shared google drive pagination link with the original coding into the template… ?

Thanks & hope to see earlier reply.


#2

Search robots does not crawl the scripts but they crawl the output processed by these scripts. Scripts hosted externally and scripts added directly into the template’s core structure makes no difference to crawlers. The difference external and internal hosting makes effects only your page load time. If your script is hosted internally then it will be loaded fast compared to external http request. I normally host all scripts inside the blogger template after compressing them. You can surely compress the Javascript and then add it directly into the template below <head> tag.


#3

I would second to Mohammad. My blog loads extremely fast when I add JavaScript or jquery inside the template without uploading it on external server. It saves both time and offer easy way to edit the scripts directly.


#4

Thanks Mohammad for your kindly reply…its now been cleared to me.


#5

I want to try to move all the scripts to the template, but I don’t know how to call the script and compression

before the script is called using

< script src = "// URLscript ‘type =’ text / javascript '/>

how to switch url into the script code


#6

you can easily do it by following steps

Go to that src. Like, For Example, If your blog’s template have following code:

<script src='http://yourjavascript.com/17719552144/emoticons.js'/>

You have to open http://yourjavascript.com/17719552144/emoticons.js and copy all code on that page.

In your template, Add <script type='text/javascript'> and then paste the code you have copied from http://yourjavascript.com/17719552144/emoticons.js.

then of course! close the script tag by using </script>

It will now look like bellow:

<script type='text/javascript'>
function addSmiley(dummy)
{var d=[],i=0,def=['post-body','entry-content','comment-body'];for(i=0;i<def.length;i++)
{var content=document.getElementsByClassName(def[i]);for(var j=0;j<content.length;j++)
d.push(content[j]);}
for(i=0;i<arguments.length;i++)
{var content=document.getElementsByClassName(arguments[i]);for(var m=0;m<content.length;m++)
d.push(content[m]);}
for(var i=0;i<d.length;i++)
{d[i].innerHTML=d[i].innerHTML.replace(/\:\)/ig,"<img style='border: 0; padding:0'  src='http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif'/>")
d[i].innerHTML=d[i].innerHTML.replace(/\/hihi/ig,"<img style='border: 0; padding:0' src='http://farm1.static.flickr.com/148/409434711_7c32198636_o.gif'/>")}}
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}
addLoadEvent(function(){addSmiley();});
</script>

Hope It Works!


#7

thanks. whether all scrip like that? including the blog widget?


#8

yes. Some Scripts don’t have type='text/javascript but you can identify it if it is javascript or not but just looking on its src url. If in src url’s end you find .js , then it is 100% sure that this is javascript.


#9

then how to compress such as @Mohammad say , whether the script will still run well or even eliminate some functions?


#10

using compressors like refresh-sf.com


#11

Thank for information about JavaScript-NareshIT