Why does Firebug just display JavaScript after restarting Firefox? [duplicate] - javascript

This question already has answers here:
Firebug says "No Javascript on this page", even though JavaScript does exist on the page
(17 answers)
Closed 7 years ago.
Even after i explicitly said that there is a difference in my bug from existing bug some modearators have marked it as duplicate may be i have not explicitly mentioned the difference so i am highlighting here
In my case the error goes away ie., i am able to view the javascipt in the debugger once I restart the Firefox
I know there is a post, which mentions the issue of Firebug not displaying JavaScript with the following error message:
If tags have a "type" attribute, it should equal "text/javascript" or "application/javascript". Also scripts must be parsable (syntactically correct).
But in my case the error goes away once I restart the Firefox.
This has been happening since the last update of Firefox. Earlier versions were not having this problem.
Is there any way to tweek Firefox, so that I don't have to restart Firefox every time to debug my JavaScript?

Note that the browser does not interpret scripts with type="text/x-jsrender" and therefore Firebug (or the built-in DevTools debugger) doesn't display the contents of the <script> tag.
Also note that JsRender templates are not JavaScript, so they cannot be debugged with JavaScript debuggers. It is JsRender that uses the type text/x-jsrender as indicator that it needs to parse the contents within the <script> tag.
You will be able to see the contents of the tags within Firebug's HTML panel, though.

Related

document.querySelectorAll([classname]) not working in IE9 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
IE9 equivalent of querySelectorAll
I'm trying to get all elements with the classname "video" in some JS running in IE9. I'm using var videopanels = document.querySelectorAll(".video"); which is working great in Chrome.
Unfortunately I'm getting this error when I watch document.querySelectorAll(".video") in the debugger:
document.querySelectorAll(".video")
Object doesn't support property or method 'querySelectorAll'
Error
However, when I watch document in the debugger (it shows up as a DispHTMLDocument) and open up the [Methods] list, I see
querySelectorAll()
querySelectorAll(v)
IHTMLDOMChildrenCollection
What's going on? How come I can see it in the debugger, but not (apparently) actually call or use it?
Change your doctype to html5 standards.
<!DOCTYPE html>
Also check IE9 isn't operating in compatibility mode as this may cause it to ignore some methods it supports.

"Object doesn't support property or method 'getAttribute'"

I'm working with Dynamics CRM 2011 Online and trying to refactor some code that works on the Quote > Add Product page to also work on Order > Add Product. The problem is that when the page loads I get the error "Unable to get property 'getValue' of undefined or null reference."
I went into the IE console (tried both IE 9 and 10) and typed in what I believed to be the offending line:
Xrm.Page.getAttribute('ati_clin').getValue()
It complains with "Object doesn't support property or method 'getAttribute'". I also tried
document.getElementById('ati_clin')
but that too fails.
This doesn't make sense to me because I can use the HTML view of the developer console to find the object on the page and it's clearly there (no typo too). It also doesn't make sense that this statement fails in the console on both pages even though one of the pages runs properly at runtime and the other doesn't. Shouldn't it at least work on the page that does work at runtime?
After doing some research I think the following posting is the most relevant but I'm afraid it doesn't lead me to an answer seeing as how new I am to this: Xrm.Page.data is null
My question is why does the console return this error if the element clearly exists?
A handy trick when debugging a problem like this:
The Xrm.Page object lives in the context of a frame. If you want to use console in IE Developer tools without having to break in debug mode, you first have to point to the frame on the page.
Example:
frames[0].Xrm.Page.getAttribute('ati_clin').getValue()

How can i debug jquery object [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Debug Javascript
Every now and then i have one jquery object and i am not able to find whats inside it.
I had to try many combinations like see the class name , id and other attributes to see what is that variable and sometime by hiding it.
Is there any proper way of debugging the jquery object to see whats inside it?
Firebug, Internet Explorer Developer Toolbar, Chrome Developer Tools. These are some of the tools for some of the respective browsers.
Some IDES like eclipse let you debug inline.
Also there is a javascript statement : debugger;, which you can use for this purpose .
Using firebug or the chrome developer tools you can debug any javascript object.
You need to add a breakpoint just after the object initialization and then add the object to the watch panel.
Object members are displayed in a tree view.

IE9 - Mime-type mismatch - Object doesn't support property

I'm playing around with a JQuery plugin called JRumble: http://jackrugile.com/jrumble/
I setup a simple fiddle to test: http://jsfiddle.net/phillipkregg/4LP65/6/
You can see that the plugin is working fine in Chrome and Firefox, but on IE9 I am getting some errors.
Took a screenshot of the IE Developers tool to show what it is referring to:
I copied the text in the console just in case that image is hard to read:
HTML1115: X-UA-Compatible META tag ('IE=EmulateIE7') ignored because document mode is already finalized.
4
HTML1115: X-UA-Compatible META tag ('IE=EmulateIE7') ignored because document mode is already finalized.
4
HTML1115: X-UA-Compatible META tag ('IE=EmulateIE7') ignored because document mode is already finalized.
4
SEC7112: Script from https://raw.github.com/jackrugile/jRumble/master/demo/js/jquery.jrumble.1.3.min.js was blocked due to mime type mismatch
show
SCRIPT438: Object doesn't support property or method 'jrumble'
show, line 26 character 2
When I looked up issues with Object doesn't support property or method 'jrumble' , some of the solutions suggested that this can be caused by an id or class name that is the same as a JavaScript variable name. However, there are no conflicting names in my simple example and it is still not working in IE.
Just from looking at the console, it seems the issue might be a mime-type mismatch that is preventing JRumble from being seen by IE.
Is this indeed the problem? Does anyone know how to go about getting around this issue?
Thanks!
To further troubleshoot this, go to the Network tab, start capturing, then reload the page. Find the script and go to its detailed view. Check the content-type response header and see what it is.
This problem can be circumvented by serving the file from your own server with the correct headers.

Javascript + Firebug console.log(), how to not get exceptions?

I'm writing a javascript / HTML5 canvas library to provide basic GUI elements for web audio applications.
There's a little demo script that creates widgets with the library and assemble them in a GUI. You can find it # http://bitterspring.net/webshifter/
The problem is, it seems to work correctly on Chrome and on Firefox 3.6 - 4.0 but, in the last cases, only with firebug. Without firebug, the script seems to visualize nothing on screen, while with firebug it does.
The only firebug-related pieces of code are some console.log statement I use to track the behaviour of the library. But these statements should have no effect on a non-firebug enabled browser, as I learnt from Firebug forums. What can prevent the example script to work, in these cases?
The library + example code is freshly committed on http://github.com/janesconference/KievII , by the way.
EDIT: Seems that, when console is not defined, console.log() throws an exception. Is there a way to keep the logging lines of code and not getting the exception? (yeah, one could check if console != undefined, but is there a better way?)
EDIT: This does the trick, it seems (Font)
if (typeof console=="undefined"){console={log:function(A){var B=false;if(B){alert(A)}}}}
Right, the console object is not available in all browsers by default.
This code:
if (typeof console=="undefined"){console={log:function(A){var B=false;if(B){alert(A)}}}}
- currently disables console support in Firefox 4's Web Console, since it tries to inject the console object when opened and won't do that if the page already defined a console object.
An interesting wrapper for console that deals with this problem is: http://benalman.com/projects/javascript-debug-console-log/ , although I haven't tried it myself.

Categories

Resources