JavaScript - Small Tips I
>> Friday, March 19, 2010
How To Make a JavaScript Externally
As I mentioned in How To Make Recent Comment II and How To Make a Related Posts Widgets in Blogger.. One of the problems with the JavaScript code in our template, is to make our web loading page become slower relatively or even could not see if there is something wrong with Script Js itself or the browser used.
To overcome this problem, we can put this Script (JS) externally.
So when the visitors browse our Site or Blog, their browser will reading our template Script first and then Script external JS after.
With this method our visitors still can see our page with more faster, although maybe there is a problem with JavaScript or compatibility of Browser used. (This is why some site owner write "warning text" on their web page "This Site Will Look Perfect In X, Y and Z browser".)
To make an external JavaScript, the first step of course, we must have a server / web host to store our JS file. If you do not have and want to have a web storage for free please read "Using Google Group and Google Sites as Web Storage".
After we have a host sever then the next step is to make your script as a JS file. Just simply find your JavaScript code, Cut it and Paste in your Notepad and save it as a JS file (.js), Store your JS file into your host server and put some "calling" code into your HTML template.
Please take look at How To Make a Blogger Related Post. cause I will use this article to make an explanation.
To make the Related Post JavaScript externally, Just Cut..! the Related Post JavaScript (the green code) and paste in your Notepad, then Save it as yourkodescript.js.
Next ..Upload / store this file into your web host and remember the URL link.
Write this folowwing script exactly on the place where the Related Post JavaScript was before.
<script src='http://Yourwebhost.com/yourkodescript.js' type='text/javascript'/>The final position will look like this,
]]></b:skin>Note : The rest of the step to make related post widget are still the same...
The Display Setting Script
<script src='http://Yourwebhost.com/yourkodescript.js' type='text/javascript'/>
</head>
Inform About The Existence Of JavaScript In Our Template
Because afraid of there are malicious script contained in JavaScript files, especially external JavaScript. Many users decided to configured their browser to disable the script, so that the script will not be able to see/read, and this means that your visitor couldn't be able to view all of your JavaScript build widget.
To anticipated this situation, we can inform to our visitors about the existence of JavaScript in our template / widget and maybe giving an explanation or guarantee that there is no malicious script inside it or no harm or it's safe.
To do this, we can simply add a small script at the end of your JavaScript Code.
JavaScriptJust like what I have done in How To Make Recent Comments. If the visitor disabled the JavaScripts browser, There will be warning text below my "recent comments title" that's says "You Need to enable JavaScript to read this"
<noscript>You need to enable JavaScript to read this.</noscript>
You can edit the 'explanation text' as you want.. how about add "Guarantee 100% no harm"..!!
Please, Write your comments.. and maybe you want to share your secret JS tips..., will be nice...





35 comments:
Many users decided to configured their browser to disable the script, so that the script will not be able to see/read, and this means that your visitor couldn't be able to view all of your JavaScript build widget.
Australian Detox
@ Australian Detox
That's way we need this "small script", to inform the visitors that they can get more "information" with no harm if they enabled their browsers JavaScript configuration.
Thanks for your tips. But I do want to mention that your article is kinda colorful. It's not easy to read.
I want to say thanks to writer very much not only for this article apart from also for his all prior efforts. I will be impending back to your blog for exciting articles once more.
Very nice script here you have shared main thing is that in major project we are mostly using this script
I just happened to come across your blog. Nice posts. I like this one very much. They are more content oriented than the usual ones you find these days. And the best part is the simplicity in your posts and the language you use in them. I have added you to my favorites. And I will continue to pay frequent visits to your blog. Expecting more such quality stuff from you. Carry on !
Hi very nice post is very informative it's fantastic. Thank you very much for sharing.
Hi thank you very for this article.
Hi the article is very informative it's fantastic. Thank you very much for sharing.
Very good and useful script you have shared with thank you for it I’ll use in my project thank you.
Hey that is awesome I am really very imperssed for your post. Thnak you very much for sharing this. Great Job keep it up,!!!
This is very informative and help full for me thank you very much for sharing this.
This is really great. Keep it up the good going. Really very great blog this has given me all the information that i needed, good for visiting daily it will increase our knowledge. Best luck for future.
It’s rare to get an experienced person in whom you may have some trust. In the world at present, nobody definitely cares about showing others the best way in this issue. How happy I am to have definitely found a wonderful web site as this. It’s people like you that make a true difference currently through the strategies they reveal.
what a nice script you have shared thank you for that.
It will be very useful for me.
It is obvious that if such a dependence does exist, it would not be of the sort that exists between material bodies, and, therefore, cannot be studied by experimental methods; because just as the nonmaterial Being (if it exists) cannot be known through sense experience, the dependence of material phenomenon on it.
i like it vary much its vary nice
I think the things you covered through the post are quiet impressive, good job and great efforts. I found it very interesting and enjoyed reading all of it...keep it up, lovely job..
Really this is new for me.. i love this awesome work.. I have never heard about this.. Superb..
Its varying compared to others.. I love this innovative concept.. Thanks..
I completely agree with the above comment, the internet is with a doubt growing into the the majority of important medium of communication across the globe and its due to sites like this that ideas are spreading so quickly.
Thanks for sharing the Java script coding guidelines.They are very helpful.Java script codings some time make me very much confused.
I would love to learn more and more about technical and programming related things. Nice to find a post which is related to my criteria. I appreciate for sharing it.
First of all thanks for creating such a wonderful site. The concepts you explained here are very clear... Good fresh Url and nice informative articles. I will be coming back in a bit, Thanks for the great article.
Thanks for providing this good informative post and i got a good knowledge from your blog, i think most of the peoples are get good benefited from this information.
Very interesting article you have got here. I love reading this kind of stuff. This is truly a great read for me. I hope to see more articles from you.
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck!
Excellent Blog. I really want to admire the quality of this post. I like the way of your presenting ideas, views and valuable content
Great blogs.I really like to say thanks to you.
Great work you done it.Good .keep it up.
Appreciate your formulating an exceptionally decent article, It happened to see your website page as well as several written piece. Is exceedingly good type publishing. joomla development
You made certain good points there. I did a search on the subject matter and found the majority of people will have the same opinion with your blog.
Web hosting with SSL
Very good perfect script here you have shared main thing is that in major project we are mostly using this script Thanks for share.
I have any word to appreciate this blog Really I,m impressed from this blog.the person who create this post it was a great ppl..thanks for shared this with us.
Your writing style is super. I liked all of them. Keep it up. Thanks a lot for sharing…. Looking forward to reading your next post..
Post a Comment