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

时间:2022-06-18 05:41:47

I'm trying to make something like pdf downloader with node-webkit. I have an input tag for the URL with some validation code. 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 :

我正在尝试使用node-webkit制作类似pdf的下载程序。我有一个带有一些验证码的URL的输入标签。它到目前为止工作得很好..但是当我尝试将这样的URL(chrome扩展名:// oemmndcbldboiebfnladdacbdfmadadm / http://www.semantikon.com/StealThisBookbyAbbieHoffman.pdf)放入网络套件时,我发现了这个错误:

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

I'm using this regexp

我正在使用这个正则表达式

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

Thanks

1 个解决方案

#1


0  

Since now one answered i'll do this myself, i did something not very nice but it works for now .. i put some function to make sure the the url starts with http or https , but in this case the use have to remove the unnecessary parts of the url like the example above

从现在一个回答我自己会这样做,我做了一些不太好的东西,但它现在有效..我放了一些功能,以确保网址以http或https开头,但在这种情况下,使用必须删除网址的不必要部分,如上例所示

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

#1


0  

Since now one answered i'll do this myself, i did something not very nice but it works for now .. i put some function to make sure the the url starts with http or https , but in this case the use have to remove the unnecessary parts of the url like the example above

从现在一个回答我自己会这样做,我做了一些不太好的东西,但它现在有效..我放了一些功能,以确保网址以http或https开头,但在这种情况下,使用必须删除网址的不必要部分,如上例所示

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