jQuery变量名称后附有大量数字 [英] jQuery variable name appended with a large number
问题描述
我经常在我从公司媒体中心加载的代码中看到jQuery在控制台中通常不可用. (否$
和jQuery
)
I often see in my code I am loading from my company's media central that jQuery is not available in the console normally. (No $
and jQuery
)
但是有时候,对于jQuery所附加的那些元素,它的数字很长.
But sometimes, to those elements to which jQuery is attached, it has a long number with it.
jQuery18306575689211022109_1378907534666
这样做的目的是什么?安全吗?
What is the purpose of doing this? Security?
此外,有时有时可以直接在控制台中使用jQuery,但只能使用上面的数字. 因此,我无法在需要使用jQuery查询的控制台中调试我的应用程序.
Also, jQuery is sometimes available directly in the console, but only with the above numbers. I am therefore unable to debug my apps in console, where I need to query using jQuery.
但是,在JavaScript代码中,jQuery完美地用作了$
和jQuery
.因此,我应用了一个断点并导出为window.jQuery = jQuery
.
However, in the JavaScript code, jQuery is perfectly being used as $
and jQuery
. So I apply a break-point and export as window.jQuery = jQuery
.
当混淆了jQuery
时,这是调试应用程序的正确方法吗?
Is this a proper way to debug the app, when jQuery
is obfuscated?
更新:
For eg., check this URL the app is calling. It seems that the URL knows what is the number appended to jQuery. How do I come to know of the same number while debugging? Any lights on what is going on?
推荐答案
似乎您在混淆两个不同的变量.您可以在以下网站上进行快速测试: http://www.jquery4u.com/function-demos/jsonp/#demo .单击运行演示",打开Chrome的控制台,键入"jQuery"以获取回调的名称,然后执行以下简单比较:
It seems that you are confusing two different variables. You can make a quick test on this website : http://www.jquery4u.com/function-demos/jsonp/#demo. Click "run demo", open Chrome's console, type "jQuery" in order to retrieve the callback's name, then perform this simple comparison :
jQuery16409391013463027775_1379048051365 === jQuery // false
也就是说,在您的情况下,名为"$"和"jQuery"的变量不可用的事实可能是由于特定的实现.一种可能是使用 jQuery.noConflict()
,它允许自定义用作对jQuery的引用,或从全局范围(window
)中完全删除对jQuery的所有引用,因此无法在控制台中访问它.
That said, the fact that the variables named "$" and "jQuery" are not available in your case may be due to a specific implementation. One possibility could be the use of jQuery.noConflict()
which allows either to customize the name used as a reference to jQuery, or to completely remove all references to jQuery from the global scope (window
), so there is no way to access it in the console.
这篇关于jQuery变量名称后附有大量数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!