Archive for the ‘Javascript’ Category

window.location not working in IE 6

October 21, 2010 Leave a comment

For some unknown reason, IE 6 Java-script engine doesn’t allow me to a new URL by simply changing the window.location or window.location.href properties.

The very same thing is working fine in IE 7/8, Chrome and Fire-fox. But IE 6 is doing nothing on a call like window.location.href = url; No error is returned and location of page remains the same.

On searching for this issue, i came to following solution.

This problem is resolved by replacing the direct java-script to a custom function call like:

function SetWindowLocation(url)
         window.location = url;
     }, 0);

Calling this function will change the location in all browsers including the funny IE 6.

Categories: Javascript Tags: ,

CATALooK Product Thumbnails

July 21, 2010 2 comments

While designing a skin for CATALook (eCommerce Module for DotNetNuke), there was a scenario where product additional images were shown in the product details page. CATALook displays some default images as thumbnails, clicking the default image opens actual image in light box.

Default Product Thumbnails

Default Product Thumbnails

Now if we want to replace the default thumbnail with actual thumbnail, CATALooK does not provide support for this. To achieve this, i edited the CATALooK skin to add ID to parent TD where the product image thumbnails control was added. You can search for the text <cat:MEDIAMENU id=”MEDIAMENU2″ Runat=”server”> in /DesktopModules/CATALooKStore/Skins/SKIN_FOLDER/ItemPane.ascx. Now we can use this ID in Java-script to replace the default image with actual product image. Following is the screenshot after adding the ID and Java-script.

Actual Product Thumbnails

Actual Product Thumbnails

Sample Java-script method can be downloaded here.
jQuery version can be downloaded here.

Categories: DotNetNuke, Javascript, JQuery Tags: ,

Cappuccino – Open Source Javascript Framework

While searching for online tools for web site prototype and mock-ups, we came across a very good and free online tool “mockingbird”.

“mockingbird is an online tool that makes it easy for you to create, link together, preview, and share mockups of your website or application.” –

Mocking bird is built using HTML and Java-script, you can give it a try to observe the rich interactivity. mockingbird is developed using open source framework “Cappuccino”.

“Cappuccino is an open source framework that makes it easy to build desktop-caliber applications that run in a web browser.”

You can further learn about Cappuccino at

Categories: Javascript Tags: ,

Javascript: Close Main Window

February 9, 2009 Leave a comment

When we call window.close(), it closes the popup windows, that are opened up using the…) method, without any issue. But when we try to call the method on a main window, that was not opened up using the…) method, window is not closed  by default and a confirm box is shown first.

In the method window.close(…) javascript simply checks if the window.opener is Null or not, if it is Null a confirm box is shown. So the trick is to set some value in the window.opener variable, this way javascript will treat this window as a popup window and the window.close will work without any message. You can try the following code yourself to experience this:

 /*This function closes the passed (or the current) window without showing the confirm box even if the window is not opened using the method */

          if (!win) //If no windows is passed – close the current window
                    win = window;

          //This will not show the confirm dialog before closing the window.
          //Javascript will treat this window as a Popup.  

”, ‘_parent’, ); 
          //Only for IE-7, this line is not needed for IE6
          //Now the call to window.close() will not display any warning/confirm dialog on IE6 and IE7