Tuesday, January 3, 2012

Chrome/Firefox/Safari Not Able to Read External Javascript/CSS

This is something a web programmer needs to take note as this could lengthen your coding time if this is not taken into account.

Chrome/Firefox/Safari is not able to read external Javascript/CSS with commands such as:

<link rel="stylesheet" type="text/css" href="testcss.php" />
<script language="JavaScript" src="testjs.php"></script>

if your broswer runs in STANDARD mode (with the declaration of DOCTYPE).


1) Include your CSS/JAVASCRIPT in your HTML file that you are running, to prevent referring to an external CSS/JAVASCRIPT

2) Run your browser in QUIRK mode (do not declare any DOCTYPE)

3) Use PHP to spit out DOCTYPE if IE browsers are detected

I would put codes like these before the <HTML> in my whatever.php:

error_reporting(0); // This is needed if your PHP spits errors/warnings to your browser
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
echo('<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
Read More »

iFrame Transparency Problem in IE and Solution

With the default setting, IE sets the background color of a HTML body to white if no value is set.

For other browsers, the background color is set to transparent by default.

In order to make IE iframe HTML to accept transparency, one has to set both the iFrame and HTML body value correctly.

The iFrame:

<iframe src="dummy.html" width=400 height=400 allowtransparency="true">

Inside dummy.html:

<body style="background-color:transparent">

Well, that's the fix for IE. Just two small steps.

Yes, this is my 2nd post in 2012. Happy belated New Year!!!
Read More »

Monday, January 2, 2012

Chrome and setTimeout() Javascript Function

I once made the O capital letter and it won't work in Chrome.

setTimeout() - OK
setTimeOut() - Not working in Chrome

Just a trivial post but it is interesting.
Read More »