I installed this popular, light-weight script on a website but it is running very poorly and maxing out my processor.
http://www.leigeber.com/2008/12/javascript-slideshow/
This is for sure my problem and nothing wrong with that script which runs fine for me on the demo site, but I have no errors and do not understand where the conflict lies. Any ideas on how to root this out?
Install firebug
Find an action (e.g. clicking on a picture) that causes slow down.
Using firebug put a break point next to where that action starts
examine the code
Related
An issue I've been having with working with JavaScript is simply debugging it in a stand-alone way. I have an extremely basic JavaScript file with just one function and a call to that function. No external dependencies. I want to debug it but it has an infinite loop which crashes the browser and won't even let me access the Chrome Dev Tools... Literally, when I hit F12, the entire thing is locked up and I have to end the process.
I have also tried running it as a "Snippet" from a different tab, which does work, but is not ideal and frankly, the entire Chrome Dev Tools interface feels strange for debugging... Like it is designed for a user not a developer, at least compared to Visual Studio.
Lastly, I tried to use Node.js by typing in "node myfile.js", and node just paused and did nothing, at which point I entered Visual Studio Code and then tried to use the Node.js debugging system from within that, but then it said that I hadn't defined a program attribute... Just trying to debug a simple js file here..
This is a problem. The whole point of debugging is to be able to figure out what's going on. What other options do I have to execute/debug a basic JavaScript file? Thank you.
I would do this, for the lack of better options:
1) Remove the critical portion of your code that is causing the infinite loop. If you're not sure which part that is, remove most of your code.
2) Open the code in Google Chrome as usual.
3) Set a breakpoint in Dev Tools at the beginning of your file or function.
4) Add back the problematic code to your javascript file.
5) Reload the page in Chrome.
The breakpoint will still be there on the same line, and you can move through your code step-by-step with F10.
Use can use debugger keyword to stop execution of javascript and debug your code.
But I strongly recommend you to remove code which is causing infinite loop.
I'm a beginner web developer. I often use Firebug to debug my JavaScript.
Problem is that there are some script files from my page's UI that have a lot of code and this causes my web browser to be unresponsive, i.e. I get a dialog saying the script is unresponsive. Basically this happens when I am within Firebug's Script panel.
How can I deal with this?
I tried finding solution to this problem and nothing.
As for the answer I think the best was posted by #Pablo(can't assign answer to comment unfortunately) and it is simply trying out Google Chrome console. None of the problems I mentioned exists here.
Cheers guys!
I have had the same problem debugging some of our older scripts that make extensive use of the eval() function.
This causes many scripts to be displayed within the Script Location Menu. (Each dynamically generated script is represented there.)
A possible solution, given that it was caused by the number of files in my instance, might be to see if you can bypass the problem entirely by utilizing fewer source files for the same code. Using a 'built' version of whatever frameworks you use might alleviate the problem. (Particularly if they still are debug-able in a built form.)
If that does not work, you might try debugging using Firefox' built-in debugger (available via Ctrl+Shift+S. (Or switch to another browser to do the debugging, but that is obviously a far less desirable solution.)
I'm working on an ASP.NET app with Visual Studio.
The problem is that every time I launch the app, the IE has some css and js file cached so I have to manually clear the cache and only then run the app.
Added a external command in VS2012 that runs this tutorial but it runs only once and then it does nothing (I didn't check what triggers this one time).
I'm looking for either VS configuration, external tool, command line, anything that will let me clear the cache by a single click without the need to open the IE.
Thanks
OK, found a solution for my problem.
Don't know how I didn't see it before but the IE debugging window has a button for clearing the cache.
I couldn't find anything similar in Chrome (didn't look in FF and Safari) but for now I'm working only on IE so that's fine.
btw: I tried several other alternatives such as writing scripts/deleting registry entries but nothing worked. Some worked for the first time until next machine restart.
I hope someone can come up with a more efficient way.
I try to debug my JavaScript but the issue is more about VS2012. When I run the website debugger it creates some dynamic pieces of code which you can study while debugging but all the JavaScript code doesn't update once I run the debugger. In short it runs the same JavaScript code as the first time I saved the respective document containing the current code. It seems to me like a pretty huge bug, and therefore it also encouraged me to investigate it through the internet but I seem to be the only one to experience it.
I think that's because you're trying to change the dynamic scripts. It doesn't work...
Instead of that, you should edit your source files and save them. If you do so, you don't need to stop the debugging process and start it again.
Just do edits in the source files and save them, then refresh your running page in browser and it works...
I am working with ie6 (unfortunately) and i am having a javascript error. Its wondrous error message gives me a line in the html source, but unfortunately the javascript that does run changes the code for the page(dramatically). So the error that its pointing me to is a closing div tag, not actual code.
Is there a way to view the updated code for the page so I can at least know where my code is breaking?
I should also point out what im developing in.
I am developing a sharepoint 2007 solution for an winxp and ie6 user base. I am working via remote desktop on a sandbox winserver 2008 r2 and can access the site from my terminal. Now, unfortunately in my sandbox server i have ie 8 in which my code works. So im stuck on ideas. If anyone knows how to view the updated source on the page, i would be very grateful.
Thanks.
Edit. I should also mention i dont have admin access on my terminal. So i cant install visual studio. It would take a couple weeks for an issue ticket for temp admin access to install it, and this is sort of important.
If you can't install anything and the error console information isn't meaningful, then about all you can do is start modifying your code until you can find which section is causing the error. The kinds of modifications you can do are as follows:
Comment out a chunk of code in a way that won't cause more errors. If the error goes away, then you know it's in that block of code or something that code calls. Put that block back in and then comment out a piece of it and so on until you narrow down where the problem is.
Start inserting alert("1"), alert("2") prompts into your code with the goal of identifying which alert the error comes before and after until you've eventually tracked down where it is. When you rule out an area, remove the alerts to make it feasible to still run the app.
On a more modern computer (e.g. Vista/Win7) go to Microsoft's site and download both Microsoft Virtual PC and the Windows image for XP with IE6. You can then actually install things into the VM and do real IE6 debugging or at least see what the actual error is.
Find a computer with XP/IE6 on it that you can install real debugging tools on.
Build your own dummy little debug window using a textarea and a couple functions that append text to it. Put that into your browser page and start sprinkling mydebug("Entering function foo") statements throughout your code so you can narrow down which statements occur before and after the error and eventually find the error. This is how I've done some IE6 debugging when it was't worth the trouble of setting up a full-blown debug environment for IE6. This works much better than alerts for some types of problems because it doesn't interrupt the flow of the app or require lots of user intervention and you can scroll back through the history.
If you are using visual studio you can use it to debug js errors in ie.
Go to the Advanced Internet settings in ie and make sure that the two
Disable script debugging settings are turned off (so that script debugging is enabled)
and that the setting
display a notification on every script error is enabled.
If you don't have visual studio installed you can download and install microsofts script debugger (it's free just google it) and use that, tho it is not as easy to work with and won't give you as much useful information