As you know that codeinspections is now malliks and also as you can see any user opening codeinspection gets automatically redirected to malliks.mazic.in, I am making this posting to explain the technical details about how we did that.
Basically in malliks we have created an index page which has an header and iframe which has the source as the codeinspections.blogspot.com and this works as expected. But I wanted to go a step ahead and let anyone coming to codeinspections automatically get redirected to malliks. I did that by adding a javascript code to the blog and the code looks like below:
This code works in firefox and IE, because these browsers doesn't all you to access the parent frame url if both the parent and child are in different domain. In the above code if user come to site as codeinspections flag will be zero and hence gets redirected to malliks, and when the user is on malliks, javascript code tries to access parent url and gets an exception, therby flag is set to one and hence user is not redirected. I tested this on IE and firefox and it worked fine.
But one of blog reader reported that blog was not opening in the chrome browser and even I tried in browser and it didn't work, it was infinitely getting redirected to malliks, i,e a frame inside a frame and so on infinite frames gets opened. This is because chrome was not giving any exception and it was allowing to freely access the parent frame url. I then added code below to make it work on chrome.
With increasing number of browsers(IE6,IE7,firfox 2,firfox 3,chrome IE8), it challenge for developers to write a code which works perfectly on all these browsers. Whats your take on this?
source: http://codeinspections.blogspot.com/
source: http://codeinspections.blogspot.com/
No comments:
Post a Comment