I've been looking for a solution to use Javascript to open or activate Firebug.
You see by default, Firebug is deactivated/closed at the corner of the status bar.
You need to click the icon to activate Firebug (the icon becomes coloured).
Is there a way to activate Firebug via Javascript in the javascript code?
see following:
// check if firebug is installed and activated
if(window.console && window.console.firebug){
// do firebug debugging and so on
}else{
alert('Firebug is not installed or activated.');
}
If you are trying to troubleshoot your own code, you can use the javascript "debugger" command to cause firebug to break on a given line of code. You will have to enable firebug debugging first for that web page. Maybe that's more along the lines of what you were looking for?
I don't think you want to trigger Firebug to open on an end user's browser; this would, at best, cause confusion for the average user.
Well, if Firebug is deactivated then its not active and cannot respond to anything. You have to actually turn it on before it can accept calls from a web page.
If there is, that option could possibly be a security hazard. Basically, you're telling FF to start up the debugger. If you could tell this debugger to even do a few things more then it could be misused by hackers.
Related
I thought I may have found the solution under this post:
Why does JavaScript only work after opening developer tools in IE once?
But my problem is I have to close/open developer mode to get the js functions running. The function will not run when I just have the developer mode open. Rather, it waits until I clicked open/close developer mode window, then it will run.
It seems to hold the function in a queue and runs it after I have opened/closed developer mode.
Any possible idea of what is happening would be greatly appreciated.
Thank you all.
EDIT:
The specific function call has the 2 lines below:
parent.document.getElementById('frameset_id').cols = '60%, *'
parent.window.frame_id.location.href='asp_file.asp?passID=' + ID
Again, the code will run when I open/close developer mode, so I do not believe it is a syntax error. I may need to explore alternatives to adjusting the cols size and assigning the frame location.
Probably because you have console.log somewhere in your code. console does not exist at all in IE when the dev tools are closed, and it silently stops your JS from running.
Is there a way I can set up javascripting in Chrome's console so that it does not process my statement as soon as I hit return. If I'm trying to test something out by just writing some javascript there, it processes before I'm done writing.
//here I am writing in the console
if ($(el).size() === 0){
//now I hit return because I want to type some stuff if this evaluates to true
//but return submits it as a finished piece of javascript and of course
//I get SyntaxError: Unexpected end of input before I can have a chance
//to finish the logic
I know I can hit shift+return and get a line break, and though that's a small inconvenience, it's still a bit of an inconvenience. Is there anyway I can tell it to hold off processing until I hit a macro like shift+return?
It's the same way in Firebug. Maybe there's an option there. Or maybe someone knows of a good third party add-on. Thanks.
In the comments I posted the ticket for the request for support, but it has been there for awhile. Chrome does have snipplets, but you have to enable them.
In the address bar type about:flags
Enable Developer Tools experiments
Restart the browser
Open the Developer Tools open the settings menu [gear on bottom right corner]
Click the Experiments tab [on left], check Snippets support
Restart the browser
In the Scripts panel, there will be a Snippets tab, click on it.
Right click on the area below and from context menu select New
You can than Edit and Run the code like a file. Run it with the context menu or play button.
A multi-line console effectively lets you do what you want. Chrome has a request for this but is otherwise not really available.
Firebug Lite for Chrome does allow it. Just click the little red button at the bottom-right of the Javascript console.
From a bookmarklet I need to open firebug and inspecting an element.
I know firebug got a command "inspect" but it seems it's not possible to execute this command from javascript.
Firebug can be driven using the new firefox command line ...but it seems we can not execute command line from javascript.
If you have an idea?
I have a bookmarklet which finds errors in the HTML code. The bookmarklet lists all elements in error. If user clicks on an element, I would like to display it in firebug inspector.
Not sure what exactly you are trying to achieve here. If you are trying to debug your own code then use javascript "debugger" command to cause firebug to break on a given line of code.
If you are looking to trigger Firebug to open at an end user's browser then this would cause confusion for the user and also this option could possibly be a security risk.
Anyway if firebug is deactivated then it can't respond to anything so you wouldn't be able to do this.
You can open FireBug just by pressing F12 in the browser
suppose i am seeing the site http://www.webspiders.com/ and i want set break point and debug the whole page. whenever i click or mouse over any element and for this action if any javascript is fired then i need to see and debug that javascript too. please help me with detail instruction for debugging with firebug. thanks.
You can enable the "Break On Next" button near the top left of the "Script" tab of Firebug. Once enabled, Firebug will break as soon as JavaScript is executed.
You will need to know where to place your breakpoints or must place a breakpoint ta all reachable members of every js file. A help would be the framework that the site use, if the is any.
Here's a tutorial on setting breakpoints in Firebug.
On the firebug script tab:
1. click on the number where you want to break the script
2. refresh
There is some problem code in a website I don't have source access to. Upon loading the page, something goes wrong (in my version of Win and FF at least) such that ajax calls are made repeatedly instead of just once. This quickly locks me out of firebug and pretty much everything else so that all I can do is close the tab.
What I want is a simple button that I can quickly hit to stop executing scripts... yet for all my googling and poking about I can't seem to find one?? I can't set a break point in firebug as I get locked out really quick as it struggles with all the ajax calls...
Surely I'm missing something simple here?
Lyle
You can use Fiddler to hijack the JavaScript code with an autoresponder and comment out the part of code that is making all the calls so you can figure out what is going wrong.
Firebug has a "Break on Next" button. It adds a breakpoint on the next execution of a script.
You can disable Javascript
Tool -> Option -> Content -> Disable Javascript (I'm on a French version at the moment, the name should be good though)
Or use NoScript
Javascript is single threaded. This means you can't interrupt executing scripts.
See NoScript.
NoScript is a Firefox extension that lets you block the problem site from running JavaScript while still allowing other sites to work as normal - no need for you to hit a button to stop it.