Hi,
I get an error 500 when I try to open my web page with IE, but not with other Programs as Firefox or Safari. The problem I think is with the redirect in the index.php file, but I don't see the problem.
Here is the code:

<?
fcnX('home.php');

And the function is a Java script:

}
function fcnX($prUrl){
  echo '<script language="javascript">' . "\n";
  echo '<!--' . "\n";
  echo 'document.location = \'' . $prUrl . '\';' . "\n";
  echo '-->' . "\n";
  echo '</script>' . "\n";
  break;
  exit;
}

Any ideas?
Thks!

Hi there,
The problem is that you are calling javascript from inside your php which is outside of it's name space. What you gotta do is in your php file : echo "<script>fcnX('home.php')</script>"; in the middle of your head section and the function will automatically be called when the page loads.

Thanks, but I dosen't seem to work either.
The strange thing is that the function as originally posted works fine in FF and Safari but not in IE. It is also strange that it works fine with IE in my local server but not in the remote server, can it be something to do with the server config??

Why are you using javascript to redirect?

Just use header('Location: http://somesite.com/page.html'); . You can use a relative url as well. Make sure you have nothing being echoed to the browser before calling that.

If you are still getting an internal server error, post more code because that function will not cause that.

Thanks, that works but I don't want to change the function because it is used several times, it works fine using a "direct" redirect. It can be Plan "B".
But I want to know why is this happening because it might be something with the config of the server I am using because it works fine in other servers. I am concern that the config of the server might be affecting other functions as well.

Hi,
When you use a cable modem or a DSL connection to try to connect to a Microsoft Internet Information Services (IIS) site that is running on a Microsoft Windows 2000 Professional-based computer, you may receive the following error message in Microsoft Internet Explorer:

Error 500

If you click to clear the Show friendly HTTP error messages in the Internet Options dialog box in Internet Explorer, and then you try to connect to the same site over the same connection, you may receive one of the following messages in Internet Explorer:

  • Bad Url
  • Bad Gateway

Note To locate the Show friendly HTTP error messages check box, click Tools, click Internet Options, and then click the Advanced tab.

Hi,
I get an error 500 when I try to open my web page with IE, but not with other Programs as Firefox or Safari. The problem I think is with the redirect in the index.php file, but I don't see the problem.
Here is the code:

<?
fcnX('home.php');

And the function is a Java script:

}
function fcnX($prUrl){
  echo '<script language="javascript">' . "\n";
  echo '<!--' . "\n";
  echo 'document.location = \'' . $prUrl . '\';' . "\n";
  echo '-->' . "\n";
  echo '</script>' . "\n";
  break;
  exit;
}

Any ideas?
Thks!

Well perhaps you may need to specify the full url in the function instead of just a page name. Below is an example of how you should use your function:

<?
fcnX('http://www.example.com/blogs/home.php');

You may find that IE is just getting confused without the full address.

Thank you all,
Problem solved, what I did was to change the function, eliminate the javascript and make a more direct:

function fcnX($prUrl)
{
   header('Location: '.$prUrl);
  exit();
}

I was so frustrated trying to understand why it wasn't working in IE that I didn't paid attention to more simple solutions.

Thanks again

Hi, i am KEN74 from <URL SNIPPED>.

The problem is in the break, it may work in some browsers, but ie have a problem with the break, if you use it outside a loop.

Remove the break , and your code will work right

Feel free to contact me if you need Non-Object PHP help.


POSTDATA : I know this post is old, but maybe this helps someone, that has this break problem.

Good luck ;)

Edited 5 Years Ago by peter_budo: Keep It Spam-Free - Do not post any affiliate links or links to off-site ecommerce sites or auctions

This question has already been answered. Start a new discussion instead.