Is it possible to block the loading of a specified script (e.g. jquery) in Firefox and Chrome?
If not, is there an addon that can do this?
Go in Chrome Dev Tools -> Network and select JS then reload the page. You'll see all the scripts, you can right click on a script to block it.
It's the same process in Firefox. Firefox Dev tools -> Network and select JS to find all scripts.
Related
I am trying to debug through some JS code in firefox. When I click on a certain file (CometdWorkerJs.js) in console, that file does not open in Debugger-Sources tab, but rather opens as raw text file. Other files open normally in Debugger-Sources tab. Due to this, I'm unable to debug through this file CometdWorkerJs.js. I've also observed the same behaviour in other browsers like Chrome.
Why does this happen? Is there a way to debug through this file ?
Screen recording of my browser's inspect window -
I found the solution to this. The code I was trying to debug is being executed inside a web worker. In chrome, the same can be debugged in chrome://inspect/#workers.
Well, I am a developer and I recently found that whatever I have written code is been exposed in the google dev tools on pages tab under the source tab. So, what do I do to hide the code?
Here is the problem...
I'm experiencing a strange intermittent issue with Chrome Developer tools hanging on to old versions of JavaScript files. I'll be developing some JS app, things humming along just find, and then all the sudden my JavaScript files will disappear from the list of JavaScript files on the "sources" tab. This is my first clue that something is wrong.
What I eventually discovered is that Chrome Developer Tools is, apparently hanging on to an old version of the JavaScript file. Chrome itself is requesting and executing the latest version from the server, but you can't debug the JavaScript file.
I "proved" to myself that this was what's happening by taking a particular JavaScript file that had disappeared from my sources list, and replacing it with a one line console.log statement.
I then reloaded the page, and noted that the console.log statement appeared in the JavaScript console. I also noted in the Network tab that the JavaScript file was successfully retrieved, and that what came down over the wire contained just the one line console.log statement.
However, the JavaScript file still didn't appear in the sources list, and if I clicked on the filename in the console (where it appears on the righthand side of the console, next to the logged statement), then I jump to the sources tab, and an old version of the JavaScript file is opened.
This JavaScript file is loaded onto the page via a regular <script> tag. It is not loaded dynamically, via another script, or via eval. Just a plain, vanilla <script> tag that points to the .js file on the webserver.
I've tried:
Ensuring that "Disable cache (while DevTools is open)" is checked in the DevTools settings.
Manually clearing out my cache and cookies in Chrome.
Restarting Chrome
Manually loading the JavaScript file in a separate Chrome tab
Disabling every Chrome extension/app that I have installed
Running the page in incognito mode
Uncheck both "Enable JavaScript source maps" and "Enable CSS source maps"
None of these changed the behavior. You can watch a video demonstrating this here, if you don't believe me!
I do think it's a Chrome issue, as I can use Firefox without this issue... but I really like Chrome and Chrome's developer tools :-) So I'd like to get this working in Chrome...
Update I reported this as a Chrome bug here. If this bug is affecting you, or important to you, please vote it up and/or add comments with additional information.
Chrome DevTools works fine for me. When I load it for a page it remembers beyond the lifespan of the chrome process what sources I have open; although it gets the order wrong. I see two differences in our devtools prefs: disable cache and enable maps. So I would advise:
1) uncheck disable cache (while DevTools is open),
2) (if 1 didn't work) press the "Restore defaults and reload" button.
The issue persists in 78.0.3904.97. To fix it run settings > advanced > reset.
Some code editors such as rubymine cache js files.
To solve for rubymine: File > Invalidate Cache/Restart
As suggested here https://groups.google.com/d/msg/google-chrome-developer-tools/2rolf--fJ3M/UTJQaZN3K28J, for development environment I added these headers when serving a sourcemap:
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
and it seems to do the job (at least for now).
I am using Firefox 28.0 on Mac OS 10.6.8. Sometimes during web development, probably after my application crashes, Firefox suddenly disables Javascript in one particular tab. So my application would be all weird and not work until I restart Firefox. The script panel would say that the page has no scripts, and if I open another page with Javascript in the same tab, it would not work either.
Is it some kind of safety feature? Is it documented anywhere? Note that I also have Firebug installed, and I managed to crash Firefox by profiling my app in Firebug on more than one occasion.
I checked about.config; javascript.enabled is set to true.
I'm trying to use Firebug to debug a JavaScript file in an extension I've added to Fx 4.
Can anyone tell me how to do it? I can only see website scripts.
Use Chromebug it's firebug for extension development, witch will give you the full ability to inspect debug firefox it self and all firefox extension as if it's a webpage :)
1- install the latest version from here: http://getfirebug.com/releases/chromebug/
2- Winkey+R to open run then type firefox.exe -chromebug this will run firefox with chromebug
3- for more information visit http://getfirebug.com/wiki/index.php/Chromebug
Please see MDN - Building An Extension - Debugging Extensions, which shows what tools Firefox provides you with to natively debug extension, also take a look at Dive Into Greasemonkey - Debugging User Scripts (PDF, p.13) which is aimed more specifically at your request.
Other than that, see How to debug a Greasemonkey script with the Firebug extension?
On Firefox 19 or later, it's possible to use the built-in JS debugger on the browser itself. Go to about:config and set the following two prefs:
devtools.chrome.enabled: true
devtools.debugger.remote-enabled: true
After you restart the browser, you can access the Browser Debugger through Tools > Web Developer > Browser Toolbox.
(note that you must accept the incoming connection)
See more at: https://developer.mozilla.org/en-US/docs/Mozilla/Debugging/Debugging_JavaScript#JavaScript_Debugger
In the bottom right hand corner there should be a little Firebug icon. Single or double click to open then you see some tabs at the top. Click the "Console" tab for real time debugging, or the "SCript" tab to view the scripts that have been loaded. Note, you can also load CSS and HTML through Firebug, use the "Viewer" icon to view HTML code on the page in real time.