问题:XMLHttpRequest cannot load file~~Origin 'null' is therefore not allowed access
来源:互联网 发布:青岛seo排名软件 编辑:程序博客网 时间:2024/05/16 04:58
学习《JavaScript DOM编程艺术》时
例题中的request.open("GET", "example.txt", true);得不到正确执行
在浏览器中调试发现错误信息为:
XMLHttpRequest cannot load file~~Origin 'null' is therefore not allowed access
网上很多文章说是chrome不支持本地Ajax请求,解决方法为:
在本地chrome快捷方式->属性->目标中添加
"--allow-file-access-from-files"
进行该操作后问题未得到解决
尝试通过服务器解决这一问题,在配置好iis服务器后,问题得到解决
过程如下:
Step 1:控制面板->程序->打开或关闭Windows功能->Internet信息服务,设置如下:
Step 2:控制面板->系统和安全->管理工具->Internet信息服务管理器(IIS)管理器(不是”Internet信息服务管理器(IIS)6.0管理器“)
网站(左侧栏内)->Default Web Site
(1) ASP->启用父路径->设置为true
(2) 操作(右侧)->高级设置->物理路径->设置为本地磁盘
(3) 默认文档->需要有*.asp,*.htm,*.html(* 为default和index),缺少的话,点击“添加”进行添加
(4) 功能视图(下面)->编辑绑定(右边)->添加或者设置端口名(网上似乎都设置为8080)
Step 3 :验证成功
在设置的硬盘中新建名为1.jpg的图片文件,在浏览器地址栏中输入http://localhost:8080/1.jpg能显示图片。
书中例题也能正确验证
- 问题:XMLHttpRequest cannot load file~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- 如何解决XMLHttpRequest cannot load file~~~~~~~Origin 'null' is therefore not allowed access
- jquey XMLHttpRequest cannot load url.Origin null is not allowed by Access-Control-Allow-Origin
- js bug: Origin 'null' is therefore not allowed access.
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
- XMLHttpRequest Origin null is not allowed by Access-Control-Allow-Origin
- XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
- XMLHttpRequest在请求失败(Origin null is not allowed by Access-Control-Allow-Origin.)
- XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin
- Origin null is not allowed by Access-Control-Allow-Origin.
- Spring Security 引用数据库管理用户权限-----login.jsp 提示"用户名或密码错误"
- 剑指offer面试题之求数组中逆序对的个数
- hibernate实现增删改查的各种方法
- 找素数
- Eclipse加入PHP插件并支持PHP自动提示
- 问题:XMLHttpRequest cannot load file~~Origin 'null' is therefore not allowed access
- Netty精粹之TCP粘包拆包问题
- IP之于游戏
- 集成学习
- STM32——流水灯
- (6)排序算法——堆排序
- markdown临时记录
- MFC获取系统时间
- unresolved symbol @__security_check_cookie