【问题标题】:Error on downloading file with node-webkit ( "chrome-extension" in the URL)使用 node-webkit 下载文件时出错(URL 中的“chrome-extension”)
【发布时间】:2016-01-28 00:06:42
【问题描述】:

我正在尝试使用 node-webkit 制作类似 pdf 下载器的东西。 我有一个带有一些验证代码的 URL 输入标签。 到目前为止它工作得很好..但是当我尝试像这样放置 URL 时 (铬扩展://oemmndcbldboiebfnladdacbdfmadadm/http://www.semantikon.com/StealThisBookbyAbbieHoffman.pdf) node web-kit 给了我这个错误:

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

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

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

谢谢

【问题讨论】:

  • 我知道这是因为“chrome extension://oemmndcbldboiebfnladdacbdfmadadm/”,但也许这个应用程序的用户不知道..所以我该如何解决它..或删除它而不影响 pdf 文件下载。

标签: javascript regex node.js google-chrome node-webkit


【解决方案1】:

既然现在有人回答我会自己做这个,我做了一些不是很好但它现在可以工作..我放了一些函数来确保 url 以 http 或 https 开头,但在这种情况下使用有删除 URL 中不必要的部分,如上面的示例

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

【讨论】:

    猜你喜欢
    • 2014-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-10
    • 2011-05-20
    相关资源
    最近更新 更多