无法使用jQuery按钮链接连接外部HTML文件

Unable to connect external HTML file using jQuery button link

本文关键字:连接 外部 HTML 文件 链接 按钮 jQuery      更新时间:2023-09-26

我曾尝试使用href连接到同一目录中的HTML文件,但加载页面时出错。

它给出以下错误:

XMLHttpRequest cannot load file:///C:/Users/Nadeesha/Desktop/Collect/FounderR.html. Received an invalid response. Origin 'null' is therefore not allowed access.

我能做些什么来解决这个问题?

<a data-theme="d" data-corners="false" data-role="button" href="FounderR.html">
       <img src="images/icons/round/64x64/entr.gif" alt="entr" style="display: block; margin: 0 auto">
        Founder
</a>

如果您正在使用chrome,并且我假设您正在使用,那么在localhost上工作时将面临CORS问题。

我建议你读一下:

https://developers.google.com/storage/docs/cross-origin?hl=es