简体   繁体   English

使用node-webkit下载文件时出错(URL中的“ chrome-extension”)

[英]Error on downloading file with node-webkit ( “chrome-extension” in the URL)

I'm trying to make something like pdf downloader with node-webkit. 我正在尝试使用node-webkit制作类似pdf下载器的东西。 I have an input tag for the URL with some validation code. 我有一个带有一些验证代码的URL输入标签。 it works just fine so far .. but when i try to put URL like this one (chrome extension://oemmndcbldboiebfnladdacbdfmadadm/ http://www.semantikon.com/StealThisBookbyAbbieHoffman.pdf ) node web-kit gives me this error : 到目前为止,它仍然可以正常工作..但是,当我尝试将URL设置为这样时(chrome扩展名:// oemmndcbldboiebfnladdacbdfmadadm / http://www.semantikon.com/StealThisBookbyAbbieHoffman.pdf ),该节点Web工具包给了我这个错误:

message: "Protocol "chrome-extension:" not supported. Expected "http:"."

I'm using this regexp 我正在使用此正则表达式

/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?\.pdf$/gi;

Thanks 谢谢

从现在开始,有人回答我会自己做,但是我做的还不是很好,但是现在还行。.我放了一些函数以确保url以http或https开头,但是在这种情况下,必须删除网址中不必要的部分,例如上面的示例

chrome extension://oemmndcbldboiebfnladdacbdfmadadm/http://www.semantikon.com/StealThisBookbyAbbieHoffman.pdf 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM