The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Access Control Allow Origin

jerryforemanjerryforeman Member
in Help edited August 2013
I am using javascript to automatically add an item to the cart when a page loads with this code:
<script src="//" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">{
var cart_request = ' mile||da40692f338e2d07c1ffd4263970c92cdcb261d116bc54c96dc5b2549fd1dca6&name=Tucson 10.05.13||0ce7904716cefcdf2e945d9769fe9ce725c4d33088693a1c5ffaa1646b2c6fb6&code=21||f696a2b64bb4ec69ebb699588c317bb9012857d045c4fc019942e4e8846d98fa&category=team-entry||8c0912f4a30bbc474d4cfc9e4deae87e3821aa4910b9d3394c5ab81c55adbb65&price=10.00||980890253a5c75dc83d1230c8b08fbfa960ccbeedd56384c0ba2d210c5e0a5ff&quantity=10||a2339709398d82d14ab06f73c25e40bec9ec71553b6140c28c202070cbd14dc9&quantity_min=10||2eddd560064877433ba89e38d5013d972fef20ef44a48b25c4bd25ece0881f6b&h:team_code=218834&h:auto_add_team=91333&url=||00fbd0dd0baf7b7b4562a187a7b29a0b7c40f15075b15ae43d5201739c1c5867&image=||1608293dd5f868a301d37b72436426d8213c14c040bb11c0f125c1dffbbb1a3d'+fcc.session_get();
return true;

This works fine in Safari, Firefox and iOS. When using Chrome on a Mac, and certain Android phones, I get an error:
XMLHttpRequest cannot load mile||da40692f338e2d07c1ffd42639…2436426d8213c14c040bb11c0f125c1dffbbb1a3d&fcsid=9rij04jpur3qm81vbjr54ap6p2. Origin is not allowed by Access-Control-Allow-Origin.

I have tried putting this at the top of my PHP page, but it doesn't change the behavior:
header('Access-Control-Allow-Origin: *');

Any suggestions?
  • fc_adamfc_adam FoxyCart Team

    Could you whisper me your store URL by checking the 'whisper' box and entering my forum username please? I'd like to take a look at your page and get some members of the team to test as well.
  • I also have the similar problem.
    I opened the cart in iframe. When i click on the foxycart checkout it is redirecting to the checkout page but if i click on paypal checkout it is throwing error as Refused to display 'paypal-path' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
    i tried to put it in header but i am having the same problem.
  • fc_adamfc_adam FoxyCart Team
    edited August 2013

    Ok - I see the issue there, it's actually two-fold. Firstly, you need to correct any instance of "& #038;" to just "&". That's breaking your add to cart URL.

    Secondly, make sure this is appended to the end of your add to cart request: "&output=json&callback=?"

    Once you've done that, you should be good to go.

    @piyushbalapure - you might be running into a similar problem as I noted in that second part.
Sign In or Register to comment.