首页 > 其他分享 >Safari Webkit, NotAllowedError: The request is not allowed

Safari Webkit, NotAllowedError: The request is not allowed

时间:2024-10-13 22:12:33浏览次数:1  
标签:console log request NotAllowedError Webkit Console navigator Evaluation

使用tauri v2,跑前后端项目学习时,遇到这条报错:

Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

测试代码

console.log(navigator.userAgent);
navigator.permissions.query({name:'camera'}).then(per=>console.log(per.state));
navigator.mediaDevices.getUserMedia({audio: true}).then(stream => console.log(stream)).catch(err => console.error(err));
navigator.mediaDevices.getUserMedia({video: true}).then(stream => console.log(stream)).catch(err => console.error(err));

结果

[Log] Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
[Log] prompt
[Error] NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
	Console Evaluation (Console Evaluation 26:5:115)
[Error] OverconstrainedError {message: "Invalid constraint", constraint: "", name: "OverconstrainedError"}
	Console Evaluation (Console Evaluation 37:3:115)

虽然是prompt,但没有弹窗申请权限,所以导致NotAllowedError

解决

tauri还不成熟,换用electron吧
https://github.com/tauri-apps/wry/issues/85

标签:console,log,request,NotAllowedError,Webkit,Console,navigator,Evaluation
From: https://www.cnblogs.com/nolca/p/18462652

相关文章

  • requests 模块 - post 请求
    1、post请求requests请求方法除了get请求方法外,还有其他方法,比如常用的post方法。post应用场景如下:(1)网页需要登录的情况。(2)需要给网页传输内容的情况。post用法和get用法一样,只是发送请求时需要加上data参数。2、代码示例importrequestsurl='https://fan......
  • requests模块 - get
    1、Requests请求常用url:请求的url地址,接口文档标注的接口请求地址。params:请求数据中的链接,常见的一个get请求,请求参数都是在url地址中。data:请求数据,参数表单的数据格式。json:接口常见的数据请求格式。headers:请求头信息,http请求中,比如说编码方式等内容添加。cook......
  • Python爬虫快速入门(Requests+BeautifulSoup+Scrapy)
    目录1.为什么需要爬虫2.爬虫的方法2.1Requests2.2BeautifulSoup2.3Scrapy3.爬虫的注意事项1.为什么需要爬虫    爬虫是重要的数据获取方式,理论上任何网上公开可视的数据都是可以获取到的。在学术研究等场合中除了使用直接的数据集以及各种搜索引擎提......
  • 关于Requests交互超时的处理方式
    拿https://aes.cryptohack.org/ecb_oracle这道题来做示范。由于这个链接的本地服务器在外国,因此我们很容易就会连接超时。如下一个脚本:importrequestsfromtqdmimport*fromCrypto.Util.numberimport*known=b''foriinrange(31,0,-1):text=hex(bytes_......
  • Need BLUETOOTH PRIVILEGED permission以及requestMtu导致蓝牙断连问题
    在部分Android手机上,当连接上GATTService后直接requestMtu有可能会造成蓝牙连接中断,随后继续重新连接会报错NeedBLUETOOTHPRIVILEGEDpermission1//扫描成功后连接gatt2BluetoothDevicemRemoteDevice=mBluetoothAdapter.getRemoteDevice(result.getDevice().getAddress(......
  • RequestContextHolder
    官方api说明没有找到教程https://www.jianshu.com/p/7b0dc8c9090e一、RequestContextHolder简析在Web开发中,service层或者某个工具类中需要获取到HttpServletRequest对象还是比较常见的。一种方式是将HttpServletRequest作为方法的参数从controller层一直放下传递,不过这种有......
  • 修复HTTPS升级后出现 Mixed Content: The page at 'https://xxx' was loaded over HTT
    背景由于需要使用摄像头拍照,需要将原来的http升级到https,通过一顿捣鼓,升级成功。不过页面加载出现了问题,具体的提示是说:你的页面是在https环境,但是你访问了一个资源(我这里是iframe,也可能是stylesheet等其他资源),而这个资源是在http环境下的,浏览器不给你这样玩。https只能访问h......
  • python爬虫 - 进阶requests模块
      ......
  • 使用 Apatch HttpRequest 的情况下,使用 HttpRequest.execute 方法, 假如该方法抛出了
    在使用ApacheHttpClient时,如果调用HttpRequest.execute()抛出了异常,通常情况下,异常不会直接包含完整的responseentity。特别是当服务器返回错误响应(如4xx或5xx状态码)时,execute()方法可能抛出各种类型的IOException或HttpResponseException,但这些异常并不一定会携带......
  • 【JS】requestIdleCallback实现分块执行
    点击按钮后,执行一个耗时较长的dom操作,页面很长时间没有响应,给用户一种卡死的现象<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0">&......