VueJS-DOMException:“操作不安全." [英] VueJS - DOMException: "The operation is insecure."

查看:87
本文介绍了VueJS-DOMException:“操作不安全."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上(使用Vue)在控制台中收到 DOMException:操作不安全." 错误.仅当它托管在github页面上时才会发生,但是在本地运行时不会出错.

I am getting DOMException: "The operation is insecure." error in the console from my website (using Vue). It only happens when it's hosted on github pages but it it doesn't error when it's being run locally.

Github页面网址: https://cubxity.github.io/ks/#/display/2227?scopes =& displayTime = true

Github page url: https://cubxity.github.io/ks/#/display/2227?scopes=&displayTime=true

我的浏览器是Firefox,内部版本ID:20181206201918

My browser is Firefox, build id: 20181206201918

推荐答案

TL; DR:这不是Vue问题:您不能以编程方式更改通过DOM输入的表单的内容.

TL;DR: This isn't a Vue issue: you cannot programmatically alter the contents of a form input through the DOM.

由于数十年的利用,输入文件字段由浏览器DOM代码更严格地控​​制.在这种情况下,不允许您自动(以编程方式)填写文件表单的内容,用户必须通过选择触发器手动进行填写.

Input file fields are more rigorously controlled by the browser DOM codes because of decades of exploits. In this case, you are not allowed to fill in the contents of the file form automatically (programatically), the user must do it manually through the selection trigger.

这不是Vue,而是HTML/DOM安全性,可防止脚本触发上传.有更多知识的人可以给出更好的答案,但我相信这是基本问题.

This isn't a Vue thing, it is an HTML/DOM security thing to prevent scripts from triggering uploads. Someone with more knowledge can give a better answer, but I believe that is the basic issue.

我总是尝试在输入表单下方提供一个指向该文件的简单超链接,而不是尝试预先填充该表单输入,以允许对现有文件进行任何访问.

Instead of trying to pre-populate the form input, I always provide a simple hyperlink to the file just below the input form to allow whatever access was intended to the existing file.

这篇关于VueJS-DOMException:“操作不安全."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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