Monday, February 8, 2010

IE Problems

1. Display Content quickly but then "Internet Explorer cannot display the webpage"
1) Press "Esc" before it shows "Internet Explorer cannot display the webpage"
2) Double-click the warning sign at the status bar
3) HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
4) Checked the HTML source code, can't really see any problems
5) Another project works fine, only difference is the layout.php, only
<?php echo $sf_data->getRaw('sf_content') ?>
6) Change the layout template, worked.

2. Empty Image src cause the rest code does not display
<img src='<?php echo image_path('xxx/xxx.png') ?>'/>
but because that image file does not exist, the code after the image doesn't display.

Empty Image src can destroy your site
http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/

Use PHP file_exists to check if file exist.
<?php  $filename = image_path('clients/'.$sf_user->getCurrentClientId().".png");
            if(file_exists($filename)) {?>
            <img style="float:left;margin-right:5px;" src='<?php echo $filename ?>'/>  
<?php  } ?>

3. href onclick doesn't work in IE (work in Firefox)
a href="javascript:void(false);" onclick="alert('here')"

add '; return false;'
a href="javascript:void(false);" onclick="alert('here'); return false;"

4. checkbox onchange doesn't work in IE (work in Firefox)
input type="checkbox" onchange="alert('here')"

change to onclick
input type="checkbox" onclick="alert('here')"

5. href return function(value) doesn't work in IE (work in Firefox)
a href="url" onclick='return function();'

change to
a href="javascript:void(false);" onclick="alert('here'); return false;"

No comments:

Post a Comment