检查JavaScript变量是否曾经被声明过?(Check whether JavaScript variable has once been declared? [duplicate])
我想在我的代码中看到过去的某个人是否已经声明了
a
变量。我想到了这个:
alert(typeof(a)=="undefined") //true
但后来我测试了:
var a; alert(typeof(a)=="undefined") //also true !
那么我怎么才能检查过去
var a
某个地方是否有变化?Possible Duplicate:
How to distinguish between a variable that is not declared and a varrable that is declared but not be assigned any value?I want to see in my code whether someone in the past has already declared the
a
variable.I thought about this:
alert(typeof(a)=="undefined") //true
but then I tested:
var a; alert(typeof(a)=="undefined") //also true !
so how can I check whether there was
var a
somewhere in the past?
原文:https://stackoverflow.com/questions/8688596
最满意答案
<system.webServer>
标记专门用于IIS(7,我相信)。 它不会影响Visual Studio内部使用的Cassini服务器。 如果您只需要在实时开发环境中担心此问题,请尝试在IIS实例上进行测试。 否则,您可能希望在开发中尝试IIS Express 。The
<system.webServer>
tag is specifically for IIS (7, I believe). It won't affect the Cassini server that Visual Studio uses in-house. If you only need to worry about this issue in a live dev environment, try testing on an instance of IIS. Otherwise, you may want to try IIS Express in development.
相关问答
更多-
如何从服务器端强制设置IE的兼容性模式?(How to forcefully set IE's Compatibility Mode off from the server-side?)[2024-04-06]
我发现这两种常见的方法有问题: 使用web.config中的自定义标头()进行此操作可以允许同一应用程序的不同部署具有不同的设置。 我认为这是一个可以出错的一件事情,所以我认为如果应用程序在代码中指定了这一点,那就更好了。 此外, IIS6不支持此功能 。 在Web Forms主页或MVC布局页面中包含HTML 标签似乎比上述更好。 但是,如果某些页面不能从这些页面继承,则需要复制标签,因此存在潜在的可维护性和可靠性问题。 只有将X-UA-Compatible标 ... -
在Intranet中强制使用“Internet Explorer 8”浏览器模式(Force “Internet Explorer 8” browser mode in intranet)[2022-06-06]
看来MSFT似乎没有考虑到大型Intranet环境,我们有很多不同的Web应用程序在里面运行。 根据我在MSDN论坛上阅读的地方,没有办法绕过IE8设置。 所以,我将不得不请求我的系统管理员使用一些新的组策略来更改“兼容性视图”设置和值,并阻止用户更改该值,直到MSFT发现此错误并进行修复。 从MSDN博客文章 (强调他们的):“ 浏览器模式是在IE请求Web内容之前选择的,这意味着网站不能选择浏览器模式 。 Seem that MSFT has not consider a large intranet ... -
您提供的代码是正确的。 IE中的测试运行在我的机器上以IE11模式呈现。 如果你在页面刷新时打开了调试器,我已经遇到IE陷入文档模式的时间。 确保安装最新版本的IE也不会有什么坏处。 If a parent page sets its "X-UA-Compatible" mode to IE8, then a page running in an IFRAME under that page will inherit that setting. Adding the meta tag:
如何在IE兼容模式下在Intranet区域中识别网站(How do websites get recognized as in the intranet zone for IE compatibility mode)[2022-02-23]
那么事实证明我正在寻找的东西与代理服务器有关。 在“Internet选项”>“安全”选项卡>“本地Intranet”>“站点”中,弹出窗口中有一个复选框,其中显示“包含绕过代理服务器的所有站点”。 这是我们遇到问题的客户的罪魁祸首。 Well it turns out what I was looking for had to do with proxy servers. In Internet Options > Security Tab > Local Intranet > Sites there is ...设置标头以覆盖ASP.NET中的IE Intranet兼容模式(Setting headers to override IE intranet compatibility mode in ASP.NET)[2023-06-26]
标记专门用于IIS(7,我相信)。 它不会影响Visual Studio内部使用的Cassini服务器。 如果您只需要在实时开发环境中担心此问题,请尝试在IIS实例上进行测试。 否则,您可能希望在开发中尝试IIS Express 。 The tag is specifically for IIS (7, I believe). It won't affect the Cassini server that Visual Studio ... ASP.NET忽略Web.config中的IE7兼容模式标记(ASP.NET Ignores IE7 Compatibility Mode Tag in Web.config)[2023-09-26]
原来问题是我在使用IIS6 。 IIS6查看Web.config的部分,而不是 部分(IIS7使用它,除非它以兼容模式运行)。 要在运行IIS6时在网站的每个页面上呈现此元标记,我相信最好的选择是将其添加到您的母版页。 我最终将以下代码块添加到了我的MasterPage的OnPreRender事件中: Page.Header.Controls.AddAt(0, new HtmlMeta { HttpEquiv = "X-UA-Compatible", ... 在IE9中以兼容模式打开Intranet jsf应用程序(intranet jsf application opening in compatibility mode in IE9)[2021-04-10]
在jsf PrimeFaces中,您必须使用以下内容对标签进行重新排序经过更多的研究,我发现: X-UA-Compatible可以在Intranet站点上运行,但只有当它作为HTTP标头发布时才能使用,而不是作为元标记发布 谢谢stackoverflow! 所以通过更多的阅读和实验,我发现添加: <% Response.AddHeader "X-UA-Compatible", "IE=Edge" %> 在页面顶部,修复问题。 After a lot more research, I found out that: X-UA-Compatible does work on ...对于.Net Framwork 3.0,IIS 7.0 /集成模式: 你可能会看到, Response 对象有 Headers 键入NameValueCollection的属性(我不确定为什么选择这种类型) http://msdn.microsoft.com/en-us/library/system.web.httpresponse.headers 因此,理论上,您可以使用它来添加或删除您在问题中概述的响应中的标题。 正如我从Response.AddHeader源代码中看到的(我使用了Reflector ...您提到的标头由IIS自动添加。 更改它们的说明是在Serverfault上发布的问题。 但要回答你关于什么时候的问题,我相信你会记得你读错了什么。 我相信你所指的是, 一旦内容被发送回浏览器 ,你就无法修改任何http标题。 只要您使用Response.Write或Response.Redirect方法,就会在Rendering事件中发生这种情况。 编辑 - 添加 顺便提一下,一旦发送了标题,你就无法做很多事情...修改cookie,使用Response.Redirect等 看到这些链接: 当我调用Resp ...相关文章
更多- javascript 问题
- javascript的验证
- javascript 基本语法
- 请教javascript问题
- javascript 注释
- JavaScript 事件
- JavaScript 事件
- javascript url编码
- javascript常用对象
- javascript日期相加函数
最新问答
更多- python的访问器方法有哪些
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。
- 响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
- 在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
- NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
元素上的盒子阴影行为(box-shadow behaviour on elements) - Laravel检查是否存在记录(Laravel Checking If a Record Exists)
- 设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
- 想学Linux 运维 深圳有哪个培训机构好一点
- 为什么有时不需要在lambda中捕获一个常量变量?(Why is a const variable sometimes not required to be captured in a lambda?)
- 在Framework 3.5中使用服务器标签<%=%>设置Visible属性(Set Visible property with server tag <%= %> in Framework 3.5)
- AdoNetAppender中的log4net连接类型无效(log4net connection type invalid in AdoNetAppender)
- 错误:发送后无法设置标题。(Error: Can't set headers after they are sent. authentication system)
- 等待EC2实例重启(Wait for an EC2 instance to reboot)
- 如何在红宝石中使用正则表达式?(How to do this in regex in ruby?)
- 使用鼠标在OpenGL GLUT中绘制多边形(Draw a polygon in OpenGL GLUT with mouse)
- 江民杀毒软件的KSysnon.sys模块是什么东西?
- 处理器在传递到add_xpath()或add_value()时调用了什么顺序?(What order are processors called when passed into add_xpath() or add_value()?)
- sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
- 如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
- AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
- SQL查询,其中字段不包含$ x(SQL Query Where Field DOES NOT Contain $x)
- PerSession与PerCall(PerSession vs. PerCall)
- C#:有两个构造函数的对象:如何限制哪些属性设置在一起?(C#: Object having two constructors: how to limit which properties are set together?)
- 平衡一个精灵(Balancing a sprite)
- n2cms Asp.net在“文件”菜单上给出错误(文件管理器)(n2cms Asp.net give error on Files menu (File Manager))
- Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
- 湖北京山哪里有修平板计算机的