-4

Since Javascript doesn't support external (cross-domain) HttpRequest, is it still possible to send text message to external service using Javascript ?

In the case, the external service is not in our control. So, it's not possible to add "Access-Control-Allow-Origin:*" in the remote site.

By the way, to add a php in the local site is not the option, too.

Cray Kao
  • 573
  • 1
  • 8
  • 20

1 Answers1

-1

you should set server http response header first.It's no business with your front-end javascript code

Access-Control-Allow-Origin:*

or

Access-Control-Allow-Origin:your domain

Code is like

res.setHeader('Access-Control-Allow-Origin','*');
ngrashia
  • 9,869
  • 5
  • 43
  • 58