__flash__removeCallback problem on IE6

Every time the page unloads

If there’s a flash movie into your page using the AMF protocol to speak with the other part of the site, there may be a bug under Internet Explorer version 6 … again. The AMF protocol stands for Action Message Format is simply JavaScript – Actionscript way to get connected. And it simply registers the callbacks from both sides. So there’s simply a object/embed pair in the HTML and a Flash movie using AMF, and IE6. Everything’s OK until leaving the page. On unload the window object the generated JavaScript code breaks and throws an error. Usually it’s something like that:

function __flash__removeCallback(instance, name) {
    ... here instance is given null under IE6
}

What if embed with some js library (SWFObject)

Reading some forum posts it may be working if I was using a js/flash library such as SWFObject, but I don’t want such, because of one another JavaScript file loading and blocking the content. I just wanted the object/embed to be in my page. Continue reading

Posted in javascript, micro tutorial, web development | Tagged , , , , | 4 Comments

debug JavaScript on IE6

The built-in JavaScript debugger

While developing your next site, you’ve may noticed that under IE, specially version 6, it’s very hard to debug any kind of JavaScript code. Yes actually if you’ve configured the browser for that purpose you may get any message, which unfortunately is completely useless. In general the message is something like: “There’s an script error on some line of the code!”, but very often there’s no such line of code or it’s empty or something else. Actually that poor debugger is giving the error by the generated script code which really does not help.

Microsoft Script Debugger

The installation of Microsoft Script Debugger solves this problem. It gives the line and the code, even highlights the error.

Posted in javascript, web development | Tagged , , | Leave a comment

sprite usage and website optimization

What’s a sprite?

When a website is developed common scenario is to put all of your images used in the UI in a .css file. Yes some did not use it, which I think is too much old school, but however maybe 99.9% did make it that way. In fact in nowadays sites we’ve more and more rounded corners, more alpha in our images. But what’s a sprite at all.

Well imagine you’ve 20 of these images requested in you .css file, if we suggest we’ve only one stylesheet file. Than when your page is rendered into a browser there must be 20 requests to the server for those images. And so many requests may really slow down your page load. Using only one image with correct

background-image
background-position

properties in you css make your site load really fast. Continue reading

Posted in css, micro tutorial, web development | Tagged , , | 23 Comments

OpenLayers disable mouse wheel on zoom

What is OpenLayers?

OpenLayers is a open source JavaScript library, which helps for the usage and development of web based map applications. Usually when you use something like http://openstreetmap.org you’ve a tile server, which contains, or dynamically, renders tiles on a specific coordinates and zoom level. Such application in basic are most of the map servers you may know, as Google, Yahoo and Live (now Bing). Than you need a layer above that, that must generate the correct HTTP queries to the server and after receiving the tiles to position them correctly. Of course a open library like OpenLayers do much more. In fact this is complex JavaScript application that gives enough flexability to manipulate rich map applications.

How to disable the zoom with the mouse wheel

Very common problem (if we can say so) in map sites is the scroll, cause sometimes the user wants to scroll the page, and sometimes to scroll the map, which action results in zooming the map. Yes, there are so many solutions as many are the combinations of those scenarios. But the case here was how to disable the mouse wheel on OpenLayers. Continue reading

Posted in javascript, micro tutorial, web development | Tagged , , , | 7 Comments

Zend Framework – quick tutorial (part 3) – front controller plugins

Why writing a front controller plugin?

Almost every application uses a database connection and acl module. Why doing this in the bootstrap and to mantain many lines of code there, instead of making it clear and mantainable. Of course you can have all these lines of code in your bootstrap, but you know for serious applications that recently will become an obstacle. That’s why Zend Framework allows you to use Front_Controller plugin.

First in you bootstrap add those lines of code

/*
 * add a simple plugin to the controller
 */
 
$front->registerPlugin(new Zend_Controller_Plugin_Init())
      ->registerPlugin(new Zend_Controller_Plugin_Acl());

These two classes (Zend_Controller_Plugin_Init and Zend_Controller_Plugin_Acl) should be placed in two different files with the same names in Controller/Plugins directory under Zend folder, and garantee you that both classes will be instanciated before starting the front controller. Continue reading

Posted in PHP, web development, zend framework | Tagged , , , | 6 Comments