Javascript sniff and PHP
Internet Explorer, javascript, PHP December 13th, 2007
I think that most of the web developers at some point got a issue with a older version of MSIE and have to figure out a way to work around the issue either by re-doing it, creating another CSS or manipulating it with javascript.
I got a issue like this and with a nice little hack with PHP and Javascript I could easily fix the issue.
The issue was a iframe that needed to be resized at IE 6 at the resolution of 800×600. Who would use a browser so old with a resolution like this? Believe me, you would be impressed.
Anyway the script was basicly sniffing the browser info with Javascript and PHP at same time. Unfortunally Javascript does not give a precise information about the browser version in IE 6 and 7, returning version = 4, but PHP does.
At the end this is how the script became:
<script language=”javascript” type=”text/javascript”>
var browser = navigator.appName; /* Getting the Browser Name */
var b_version = navigator.appVersion; /* Getting the Browser Version - not reliable */
var version = parseFloat(b_version); /* Transforming the Browser Version Information to a number */
<?php
/* PHP hack for version on Javascript */
$info = explode(’;',$_SERVER[’HTTP_USER_AGENT’])
?>
var info = ‘<?php echo trim($info[1]); ?>’;
var iframe = document.getElementById(’iFrame’); /* Iframe that will be modified */
var wscreen = parseFloat(screen.width); /* Getting the size of the screen */
if(info == ‘MSIE 6.0′ && wscreen < 900)
{
iframe.style.height = 325; /* Resizing the iframe to a size that will hold all information */
}
</script>
At first I was using the 3 first vars to do the same thing as I’m doing with the var info = ‘<?php echo trim($info[1]) ?>’; and time to time it was giving errors, so this small trick became very handy.
CSS Rounded Box Generator Tool
CSS, Web Development, FireFox, Internet Explorer November 9th, 2007
Creating rounded boxes usually it’s a pain to make it work in all browsers and all screens sizes. I found this tool that it’s pretty smart and you can put it in a good use if you need to create any, simple, rounded box.
Just click the link, select the colors, and copy the result.
http://www.neuroticweb.com/recursos/css-rounded-box/
Script Debugging in Internet Explorer
Internet Explorer, javascript September 12th, 2007
Debugging your website in FireFox seems to be a paradise compare to IE. But I think this impression is becuase we love Firefox,FireBug and the Developer ToolBar. Now you can do almost the same things in IE with the combination of Microsoft Script Debugger and the IE Developer Toolbar.
Here are the links to download the above mentioned tools:
Quick note: Microsoft Script Debugging is not enabled by default. You must first enable it by going to:
Internet Options >> Advanced >> Browsing
Uncheck the Disable script debugging boxes.
Posts