使用 HTTPS 时安全地传送 Javascript 文件
我的 asp.net mvc 应用程序在 https 下运行,并且工作正常。 问题是,当用户访问网站的安全部分时,他们会收到警告,询问他们是否只想查看安全传送的内容。如果他们单击“是”,则 javascript 或 jquery 上的“非”将起作用。如果他们选择“否”,那么一切都会正常进行。 那么如何安全地提供 .js 文件呢?或者这完全取决于用户? 此外,该警告非常烦人,因为它会在导航到的每个新页面上显示它。 谢谢! 另外,这只是用户使用 IE 时的问题,Firefox 没有问题
My asp.net mvc application runs under https and it is working just fine.
The problem is when a user goes to the secure portion of the website they get the warning asking them if they want to view only to content that was delivered securely. If they click yes, then non on the javascript or jquery will work. If they select no, then it all works just fine.
How then can I provide the .js files securely? Or is that totally up to the user?
Also the warning gets very annoying at it shows it on every new page that is navigated to.
thanks!
also, this is only a problem when the user is using IE, Firefox has no issues
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
twal,
使用以下方法,它应该可以解决问题:
然后,这将使用文件的适当路径来解决其方式上的协议。
twal,
use the following approach and it should fix the issue:
this will then use the approriate path to the file resolving the protocol on it's way.
确保您引用 HTTPS 来获取完整 URL。
如果它们是相对 URL,您通常可以避免这种情况,因为它通常会使用您当前使用的相同协议。
Make sure you're referencing HTTPS for full URL.
You can often avoid this if they are relative URL as it will normally use the same protocol you are currently on.