Friday February 10, 2012 @ 20:46:28 GMT+10    ( Weather:  n/a )
Home » Weblog Archives

Powered byD's Bloggie
Weblog » Archive » 2005 » December » Day 05
Browse by day ...
 03 December, 200507 December, 2005 

Last edited: Sun 2006-04-02 @ 09:06 , by DaRen 7 time(s)

Redirection on my site - 12:16 am
Browser , Bug , Site Issue , Web Hosting  -  poster 

Oh my god... the Shout box's redirection isn't working in IE 6. I just notice it after my dad told me about this... Before this, nobody encounter any problem ??? Or nobody is surfing my site using IE (impossible) ??? Please report any problem, error or weird CSS rendering and let me know which browser you're using. I can't test my site with all the browsers... takes too much time !

*FIXED*
I made 2 mistakes on the shoutbox redirection script. However the redirection problem in comment posting part is cause by the advertisement codes inserted by the hosting server. They're using window.onload to call their javascript and I'm using the <body onload> to do my redirction, that's why redirection isn't working, they just use my window.onload WITHOUT telling me...hehe... So I remove the onlaod inside the <body> tag and place under their code and it works.

Cause of problem [ Hide ]
[ Highlight ] [ Text ]
<body onload="my_redirect()">
<!-- start of server advertisemt -->
<script type="text/javascript">
    window.onload=their_function()
</script>
<!-- end of server advertisemt -->

Solution [ Hide ]
[ Highlight ] [ Text ]
<body>
<!-- start of server advertisemt -->
<script type="text/javascript">
    window.onload=their_function()
</script>
<!-- end of server advertisemt -->
<script type="text/javascript">
    window.onload=my_redirection()
</script>


Last thing I want to say is, Opera is working fine even there's 2 onload calling, I bet it will work with 3 or more onload inside a script. IE and firefox just can't cope with the extra onload and failed. Opera rulez !

Redirecting with PHP header() - 11:41 pm
Browser , Bug , PHP , Site Issue , Standards  -  poster 

On the redirection of shoutbox, I've made 2 mistake causing it unable to work on some browsers, example IE 6. In PHP, to do a redirection is very simple.

[ Hide ]
[ Highlight ] [ Text ]
header('Location: http://domain.com/index.php');

However, don't do this [ Hide ]
[ Highlight ] [ Text ]
header('Location: http://domain.com/index.php');
die();


It seems logical if you put a die() after header('Location'). But the truth is, NO you shouldn't ! It will screw your code !
Took me some time to notice the problem. Not sure about header('Refresh') though, I'm calling die() after header('Refresh') and it seems running without problem.

Also remember to use absolute URI for the header instead of relative URI. Browser like Opera accepts relative URI but IE and Firefox ain't too friendly to it. That's the 2nd mistake I've made.
 03 December, 200507 December, 2005 
$ view_blog.php 2009.09.17 18:16:41 $
Lost? | XML/HTML sitemap | Contact
38.107.179.240 , 19 queries , 0.445s
Gzip enabled , CSS compressed , JS compressed
Copyright © 2005-2011 Darren's Outpost