Home > front end > Is there any way in js cross-domain perform like HTTP requests in a programming language?
Is there any way in js cross-domain perform like HTTP requests in a programming language?
Time:10-06
Don't know much about the js, probably, checked the XMLHttpRequest can't seem to cross domain, the json if cannot take the header, and want to be in the requested server is to set up the Access - Control - Allow - the Origin of the head, is there any way in js simulation like the HTTP requests in a programming language, do not need to set up the server, can cross domain, you can set the header, just get returns text,
CodePudding user response:
Add a proxy server front-end deployment
CodePudding user response:
This is for security reasons,
To know the general program can be completely control the whole computer, can be formatted disk, can be read from disk in any action, also can download anything on the Internet, can automatically install any program, also can not subject to consent by the users to upload any file to the server,
Obviously, you don't want to visit a web site, your computer as the web programmer mercy,
In the browser cannot cross domain, in addition to ban literally read user file, ban literally read the clipboard contents, click on the download file is not allowed,
CodePudding user response:
Cross-domain limitation is that the client browser, not js pot, no restrictions on the server side using js, Want to say, as long as the limit cross-domain read user client local files, cross-domain restrictions between websites in fact it is not necessary, You say for the sake of safety, as long as able to cross domain with their own server agent read, don't just get security on the server side?