Ajax alternative for cross origin requests

Username (e.g. epiz_XXX) or Website URL

No website in particular.

Error Message

Ajax error with status code of 0.

Other Information

Does this security system disable the setting of
Access-Control-Allow-Origin header?
It seems to.

https://support.infinityfree.net/websites/javascript-error-using-api-or-mobile-android-app/#which-features-are-not-supported

Is there an alternative way to send a cross origin request to and receive a response from a website hosted on infinityfree? One which is not restricted?
Edit:
I was using XMLHttpRequest. Maybe Ajax is plenty broad a term.

The short answer is no, we do provide a web hosting and not API hosting, you only can send ajax request from the same site.

4 Likes

Don’t think you can do that…

2 Likes

So in effect the Access-Control-Allow-Origin header is disabled?

Yes.

Thanks for confirming it. I was trying to make a bookmarklet that sends an Ajax request and shows the response from my website. Bookmarklets can be run on any domain so I guess they run into the security system too.

Any suggestions besides accepting the fact that it won’t work?

Perhaps switch to premium hosting which doesn’t have this system?

Maybe. Probably not right away. I really like infinityfree though even if it has some unhandy restrictions. Thank you

CORS is on the client-side.

Unless you are targeting users who don’t have browsers that use CORS (very rare), then I would say no.

The only other option is switch to another hosting provider (or buy premium, which technically is another hosting provider).

4 Likes

Thank you. There is actually one way to allow cross origin requests which I was trying to use. It is by setting the Access-Control-Allow-Origin header in my PHP script.(That is if I understand it right) But it seems the security system disables this header.
Anyway my code doesn’t work properly.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.