这是什么 "scheme don't have a registered handler" 错误?

what is this "scheme don't have a registered handler" error?

我正在开发一个节点应用程序。 我有一个 ejs 文件,点击一个按钮就会收到一个获取请求 url localhost:3000/posts/business-economics 但是页面没有加载并且这个错误显示在控制台中

Failed to launch 'localhost:3000/posts/business-economics' because the scheme does not have a registered handler.

我在使用本地主机时遇到了同样的错误。我试图重定向到 localhost:3000,但我的控制台上闪烁着这个错误。 事实证明,这是因为 http:// 从您尝试加载的 url 中缺少 。我很惊讶地看到还没有人回答这个问题。

有时,只是为了重新启动您的应用程序可能会改变某些东西或再次检查您提供的 url 路径也可能是那里的错误

必须在url之前设置地址协议,如:

returnUrl = window.location.protocol + "//" + window.location.host + Path

我也面临的另一个原因。如果 href 标签拼写错误 javascript.

<a href="javascript:;" onclick="myfunction()">Action</a>