VueJS - DOMException: “The operation is insecure.”

做~自己de王妃 提交于 2021-02-10 23:41:04

问题


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 page url: https://cubxity.github.io/ks/#/display/2227?scopes=&displayTime=true

My browser is Firefox, build id: 20181206201918


回答1:


TL;DR: This isn't a Vue issue: you cannot programmatically alter the contents of a form input through the 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.

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.



来源:https://stackoverflow.com/questions/53802391/vuejs-domexception-the-operation-is-insecure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!