在jsp中播放声音文件时不允许加载本地资源 [英] Not allowed to load local resource while playing sound file in jsp

查看:107
本文介绍了在jsp中播放声音文件时不允许加载本地资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

audio.src =file://///PCNAME/Songs/ABC.mp3;



当我点击播放按钮时它会给我以下错误



不允许加载本地资源



请帮帮我,我需要玩pc的其他驱动器

audio.src = "file://///PCNAME/Songs/ABC.mp3";

when I click on play button it give me following error that

"Not allowed to load local resource"

Please help me I need to play from other drive of pc

推荐答案

您编写的代码在客户端计算机的浏览器中运行...为了确保一定程度的安全性,您无法做到能够做到的事情损害最终用户,其中一个是读取(或以任何形式访问)客户端机器的本地存储...

file:// 协议尝试做到这一点!

我想你的意思是服务器机器的本地存储,但是你切换了上下文,所以它不再有效......

您应该通过您的网站公开包含文件的文件夹,并将src属性声明为有效的URI ...
The code you wrote runs inside the browser at the client machine...To ensure a certain level of security you can not do things that can harm the end-user, one of them is reading (or accessing in any form) the local storage of the client machine...
file:// protocol try to do exactly that!
I imagine that what you meant is the local storage of the server machine where, however you switched context so it is not valid anymore...
You should expose the folder with the files via your web site and declare the src attribute as a valid URI...


这篇关于在jsp中播放声音文件时不允许加载本地资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆