Firefox Cross Domain Request

前端 未结 6 1489
别跟我提以往
别跟我提以往 2020-12-30 07:39

I need to make a cross domain request from a script that runs in firefox (it\'s just for development purposes).

Can this be achieved? maybe modifying the about

6条回答
  •  鱼传尺愫
    2020-12-30 08:19

    The Same Origin Policy applies to all browsers. Using javascript you can send GET and POST requests, but you will not be able to read the response like you can with XHR. XHR's can only be done against the domain the script is executing from. This is an important rule as it prevents wide spread Cross Site Request Forgery(CSRF) vulnerabilities.

    You can use flash with a crossdomain.xml file and I think this is the most robust solution because it will do exactly what you need and have the best browser compatibility.

    EDIT: If you want specifically JavaScript running on Firefox to bypass the Same Origin Policy then you can build a custom add-on. Or perhaps the Cross Domain add-on will do what you need.

提交回复
热议问题