Currently Viewing Posts Tagged Javascript

Optimize JS in MovableType

Everyone knows my blog is powered by MovableType. Actually I start to blog from MovableType 3.11.
There is a mt.js file in root of the blog. It is 20K after generating by MovableType 4.26.
Then to make it smaller. I use Yuicompressor which is provided by Yahoo Developer Network.
Then it is only 13K. And also I use gzip compress facility on Apache server. It is 4.1k when transferring to Web Browser.
Actually before minifiy its gzip size is 5.8K.
So it is clear to make a list.
Original mt.js
20.2K, gzip version 5.8K
Minified mt.js
13.1K, gzip version 4.1K

Continue reading “Optimize JS in MovableType”

How to close current window without alert pop-up

I have an batch file in the task schedule. It runs every night. The main purpose is to launch an IE window.
The problems bother me is when it finished loading, it is still there. So after one week, there are seven windows on the desktop. I forgot to mention, it is on one Windows server.
To make the task perfect, I do a search to find the way to close window without alert popup dialog box.

<!--
window.opener = null;
setTimeout('window.close();', 10000);
-->

To disable alert popup box.
window.opener = null;
Close window in ten seconds.
setTimeout(‘window.close();’, 10000);
This Javascript script do the job correctly.

Ajax toolkit comparison

Ajax is very useful in Web 2.0 world. What is Ajax?
Ajax is Asynchronous JavaScript and XML.
Now so many different Ajax toolkits online. Which one is better?
Actually, if you doing some search on the web, you will find a lot of different results.
Some one said the Prototype is best, another one said Dojo is perfect.
How can we find the right one for yourself?
Let me compare them.
Now I have five Ajax toolkits here.
1) Prototype
2) Dojo
3) Yahoo
4) Google
5) jQuery
First of all, the learning curve is the most important issue. For the guy who has some php or other language skill, jQuery is the easiest one. You don’t need a lot of time to learn it. After jQuery are, Prototype, Yahoo, Dojo, and Google.
Next is ease of use. They are almost same. Only Google is a little bit weak.
For the file size, jQuery is smallest one.
There are many issue to be compared.

Continue reading “Ajax toolkit comparison”

How to protect your site from frame

I found some sites framed my Blog, and keep popping some bad windows.
I do a google, and found this script works to prevent from it.
Just copy the following code in to you pages. Now any site want to frame your page will automatically jump your site out.
<SCRIPT LANGUAGE=JAVASCRIPT><!–
if (top.location != self.location)top.location=self.location;
// –></SCRIPT>


<SCRIPT LANGUAGE=JAVASCRIPT><!--
 if (top.location != self.location)top.location=self.location;
 // --></SCRIPT>

  • Archives