Jump to content

[SOLVED] window.location.href error 404 in IE 6 & 7


aussie

Recommended Posts

My code is throwing a 404 not found in IE 6 & 7 works fine in Firefox.

I've put this in the javascript instead of php because I'm sure its the javascript issue.

 

After researching it seems I am to add the statement 'return true'

 

I've tried that but it still doesn't work so maybe I am not putting this statement in the right place.

 

<input type="image" name="btnAddToCart" src="images/addtocart.gif" value="Add to Cart" onClick="window.location.href='<?php echo $cart_url; ?>';" class="addToCartButton" alt="add this item to your cart">

 

I added the return true like this

<input type="image" name="btnAddToCart" src="images/addtocart.gif" value="Add to Cart" onClick="window.location.href='<?php echo $cart_url; ?>';return true" class="addToCartButton" alt="add this item to your cart">

 

still 404 page not found...

 

in my functions page is the cart url

$row['cart_url'] = "cart.php?action=add&p=$pdId";

 

I tried adding the return true statement there and that didn't work either.

I added like this

$row['cart_url'] = "cart.php?action=add&p=$pdId; return true";

 

I get this in the ie browser address bar and the page is a 404

cart.php?action=add&p=179;%20return%20true;

 

cheers..

 

 

 

Link to comment
Share on other sites

Thank you for your replies.

 

Tried taking out the .href and IE still showing 404 error page not found.

 

This code has been working for years in Firefox and up until recently was working in Internet Explorer.

 

 

How it works, When you click Add to the cart button, it just shows the same page and adds the product to the cart. So the page is there.

When you click the 'view the cart button' the product is added there.

 

Something in IE 6 & 7 has changed.

I tried IE options-> security and removed protected mode but that didn't work.

I also tried dropping the security level down to see if that made a difference.

 

I need a work around I am feeling this is either a bug in the IE or some new security thing added in the latest updates to Internet Explorer.

 

I have researched on google and it seems others are having the same problem but there are not

answers for the issue....

 

Cheers

 

 

 

 

 

 

 

Link to comment
Share on other sites

Thankyou,

 

Hmm! I have changed some of the code.

I have made a .htaccess for friendly urls, and am making the php files be html in the .htaccess as well.

To make all of that work I had to add a base href to the header.php

 

Options +FollowSymLinks
RewriteEngine on
RewriteBase /main
RewriteRule ^main/(.*).html index.php?c=$1 [L]
RewriteRule ^products/(.*)/(.*)/(.*).html index.php?c=$1&p=$2 [L]
RewriteRule ^articles/(.*)/(.*).html pages1.php?id=$1 [L]

 

Cheers

Link to comment
Share on other sites

  • 8 months later...

Thankyou,

 

Hmm! I have changed some of the code.

I have made a .htaccess for friendly urls, and am making the php files be html in the .htaccess as well.

To make all of that work I had to add a base href to the header.php

 

Options +FollowSymLinks
RewriteEngine on
RewriteBase /main
RewriteRule ^main/(.*).html index.php?c=$1 [L]
RewriteRule ^products/(.*)/(.*)/(.*).html index.php?c=$1&p=$2 [L]
RewriteRule ^articles/(.*)/(.*).html pages1.php?id=$1 [L]

 

Cheers

 

I am still having issues with this and my cart has now been broken in IE for some time....

As I said earlier it is working perfectly in other browsers. So I need a work around for IE and not break everything else.

 

I am sure I must have to add something to the .htaccess file.

When I click on the add to cart button, I get this address and a 404 error.

 

http://localhost/main/products/29/72/cart.php?action=add&p=72

 

In firefox clicking on the add to cart button then refreshes the page and show the contents in the cart.

 

So I think I need a line in the .htaccess file to remove the

main/products/29/72

and have the url go to http://localhost/main/cart.php?action=add&p=72

 

Any ideas????

Link to comment
Share on other sites

Hi,

As I am not able to receive help for this, should I post in a different section on this forum?

 

 

I do believe this is the javascript onclick event in Internet explorer only that is causing this issue.

 

Link to comment
Share on other sites

Well I found a work around I got rid of the onclick event so it works now in IE

 

Replaced:

<input type="image" name="btnAddToCart" src="images/addtocart.gif" value="Add to Cart" onClick="window.location.href='<?php echo $cart_url; ?>';return true" class="addToCartButton" alt="add this item to your cart">

 

With

<a href="<?php echo $cart_url;?>"><img src="images/addtocart.gif" border="0" alt="buy now"></a>

 

So no 404 and all is added to cart.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.