在空的MVC5项目中添加额外的脚本

4

当我创建一个空的MVC5项目并添加控制器和视图时,Visual Studio会在HTML源代码的末尾添加一些脚本,如下所示:

script id="__browserLink_initializationData" type="application/json">
{"appName":"Firefox","requestId":"bbb87a70d7564b28910b9fcf0801a4c6"}
</script>
<script async="async" src="http://localhost:63975/5e85be16690c40b598a8d96a30562d1b/browserLink" type="text/javascript">
Reload the page to get source for: http://localhost:63975/5e85be16690c40b598a8d96a30562d1b/browserLink
</script>

有人能告诉我这是什么,以及如何删除它吗?


谢谢您的询问,现在我一定会使用它... - Vishal Sharma
1个回答

3
在Visual Studio 2013中,浏览器链接(Browser Link)是一个调试帮助工具 - 当请求页面时,由HTTP模块注入HTML。 它仅在调试模式下启用(即<compilation debug="true" />),且仅在从Visual Studio运行时启用。
它可以同步不同浏览器之间的导航,并添加其他需要Visual Studio和浏览器之间通信的调试功能。
有关其作用更多信息,请参见此处:ASP.NET - Browser Link 您可以通过以下至少三种方式禁用它:
  • Turn debug mode off in web.config (in other words, it's automatically removed in release mode):

    <system.web>
      <compilation debug="false" targetFramework="4.5.1" />
      ...
    </system.web>
    
  • Add this to web.config to turn it off even when debug="true":

    <appSettings>
       <add key="vs:EnableBrowserLink" value="false"/>
       ...
    </appSettings>
    
  • Uncheck "Enable Browser Link" in the Browser Link dropdown menu - this is (for the moment, at least) a Visual Studio-wide setting - i.e. it will stay off for all projects until you enable it again: enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接