I have several debug printouts in my script with console.log(message), but no messages displayed in Console section of Firebug.
What can be a reason for this?
UPDATE 1
Neither of console.warn, console.error and console.info works.
UPDATE 2
I have a following log function:
function log(message) {
console.error(message);
$("#log").append(message + "<br/>");
}
so it logs both into Firebug console and DIV on page. I see that DIV logging works. Hence the control reaches the statements.
UPDATE 3
--irrelevant--
UPDATE 4
Update 3 was irrelevant: consoleBody in firebug.js was not always null. Later it was becoming valued.
But I saw that the content of consoleBody contains "div#log". Probably it interferes with my naming...
UPDATE 5
Renaming of ID of my DIV didn't help...
UPDATE 6
Whe I do console.log("hehe") in immediate line of firebug, it prints undefined
UPDATE 7
Looks like console.log() does not work within Liferay portlet at all; even very simple hello world portlet does not excecute this command.
Use javascript.log.enabled=false property.
This will disable firebug lite, now console.log will log to browser's console.
I'm not sure what's the reason for such behaviour for 6.0 version but I have found the reason it doesn't work in 5.2.3.
It seems that Liferay includes Firebug Lite on my page and when I press F12 it appears at the bottom. It does interceps console method calls.
Now I'm looking for correct way to remove the included script.
EDIT:
Seems like the reason for this is that I have developer mode enabled.
set JAVA_OPTS=%JAVA_OPTS% -Dexternal-properties=portal-developer.properties
Try console.info. If that fails, use one of console.warn or console.error.
There may be a setting to remove this requirement from Firefox.
The situation occurs when Liferay 6.0 is running under Eclipse. Eclipse Liferay Plugin upgrade to 1.5 didn't help.
One can set fresh Liferay installation, run it under Eclipse and try console.log('hehe') in Firebug's immediate line -- it won't work.
But this bug does not occur in Liferay 6.1 with Tomcat 7.
Looks like it was some bug of Liferay 6.0. Log works in Liferay 6.1
$("#log") does not work in Liferay 5.2. The right syntax (in no-conflict mode) for Liferay is jQuery("#log") as they use multiple js frameworks.
Someone has found a way to disable Firebug-Lite completely by renaming the dirname
webapps/ROOT/html/js/firebug.. It seems to work but I also did what SO user "Yogesh Agrawal" suggested in his answer from Jul 4 at 5:27
See http://www.liferay.com/community/forums/-/message_boards/message/14202657
Related
mixpanel-2-latest.min.js:9 Mixpanel error: "mixpanel" object not initialized. Ensure you are using the latest version of the Mixpanel JS Library along with the snippet we provide.
From the last couple of days, I am seeing this error in the console when I do inspect element in my Google Chrome. I am using the latest Chrome version 64. I am not using mixpanel. It's also showing up if I open any public website. Any idea how to resolve this error?
Check your extensions, for me it was 'Page Ruler' (https://chrome.google.com/webstore/detail/page-ruler/jlpkojjdgbllmedoapgfodplfhcbnbpn?hl=nl) that caused this error. Systematically disable all extensions until the error does not occur anymore.
I started getting this error out of the blue. It was the chrome extension PageRuler. I trashed PageRuler and the error went away.
Alternatively, you can go to Page Ruler's options menu, and uncheck "Send Anonymous Usage Statistics".
This will enable you to continue using the extensions without seeing the error message.
That's correct. The Page ruler plugin is the one who cause the console error "Mixpanel error: "mixpanel" object not initialized".
Disable it and all good to go
"Free Video Downloader" is another cause.
Check your extensions, for me, it was 'Page Ruler'.
No need to remove 'Page Ruler', Instead of removing do the following...
Page Ruler's options menu, and uncheck "Send Anonymous Usage Statistics".
I checked all given answere in here. All sayed to disable the "Send Anonymous Usage Statistics" checkbox in the settings....
I think hiding a problem is not solving a problem. Since there were a newer version of PageRuler (i had 2.1.2, newest is currently 2.1.3) I deinstalled the old one, reinstalled the new one and from now on, no matter if I send stats or not, error doesn't appaers anymore.
When I started working with OpenLayers, console.log stopped working and I kept getting this error in the chrome terminal.
GET http://127.0.0.1/my/private/dir/undefined/firebug.html 404 (Not Found)
At first I didn't realize it was OL so I uninstalled the firebug lite plugin. Then I checked the OL source and found where it's trying to inject firebug.
y=document.createElement("iframe");y.setAttribute("src",o+"/firebug.html");
Is there a way to prevent OL from doing that other than modifying the source. Also, it's overwriting window.console
I met the same problem.
I fixed it for the moment by adding:
<script type="text/javascript">
console.firebug=true;//fix the openlayer problem
</script>
before loading the openlayer script.
the reason:
console.log used to work in the previous version of Openlayer ,but not for now, so I checked the source code found there is:
if (!window.console || !console.firebug) { ...
which means I guess if there is no FIREBUG console, the console will be cleaned up and overwritten.
I think it should be a bug , so I just didn't get further into this, and try to fix it as soon as possible, waiting for the bug fixed by the Openlayer guy.
hope it work for you, if not,please let me know.
are you including an external file like firebug.js or something like that in the code.. I dont think it should do anything by defualt and it must hv sm code that checks if a certain objects exists in the scope or something.
Hope you are not using some example code and that is why you are facing this issue.
also make sure that you have the irght version of OL and not a patched version or a beta version.
please update us.
A link that I found: http://osgeo-org.1803224.n2.nabble.com/Firebug-Error-Invalid-Object-Initializer-td2866563.html
btw this is openlayers stand on it:
add OpenLayers.Console namespace and a number of methods that allow for logging of error messages - when firebug.js is included in a page, the application runs in "debug" mode - the Firebug extension or Firebug Lite handles OpenLayers.Console calls depending on availability
I ended up just commenting out the line that adds the iframe. And I load a script before OpenLayers which creates a backup of window.console.
window.console2 = {};
for(key in window.console)
window.console2[key] = window.console[key];
I'm using jQuery for my app and I'm getting this error in IE:
Line: 13
Char: 9
Error: Expected Identifier, string or number
Code: 0
..well, as you can see, the error isn't quite helpful. How do you fix those weird IE errors? Is there any tool or a list of error descriptions that tells you what to fix?
Thanks
I would suggest looking at line 13 of your JS file to find out where the error is.
FWIW, the "Expected Identifier, string or number" error often occurs when you have a trailing comma in a list or object declaration. Firefox doesn't mind this, but IE does.
Here's an article on debugging javascript in IE. IE8 comes with a built-in debugger.
The IE Script debugger is quite OK.
But try Mozilla's error console first. It has sane line numbering. Maybe the errors are identical.
Make sure you have Microsoft Office installed
In IE, go to Tools -> Internet Options -> Advanced tab
From there UNCHECK "Disable script debugging (Internet Explorer)"
Then when a script creates an error, you will be presented with a dialog box:
Click the YES button to sign your life over to microsoft to start the debugger.
This is a really tedious workflow (the default sound that happens when a script bug is encountered is really annoying) so I don't think its a good way to work, recommend firefox error console over it any day.
See also.
I get the following error in firebug in Firefox 3 with both MooTools and jQuery:
"p.onStatusChange is not a function".
I've noticed this error frequently in firebug since one of the latest updates of FF3. However, it has started appearing with code that hasn't been changed in some time and that was not reporting errors previously. The errors happens when ajax results are returned. It shows up in different applications that use separate javascript libraries, MooTools and jQuery.
Does anyone have any idea why these errors are appearing? My intuition tells me that it is something in Firefox that changed, but I can't find any information online currently. The ajax calls still work fine, but I am wary of just going with my intuition and leaving script errors in my code.
Thanks,
Jason
I get it in tabBrowser instead:
chrome://browser/content/tabbrowser.xml
(4) errors occur:
p.onStatusChange
p.onProgressChange
p.onStateChange
p.onSecurityChange
What I found was that the add-on "PDF Download" was causing these errors. The best way for me to check was to go to a page that produced the errors, turn off all the add-ons, and turn them on one-by-one (starting with Firebug). Instead of going one-by-one, I actually turned them on in lots of 3 to help identify the problem sooner.
Here is the reference for the function NsIDownloadProgressListener. It looks like it has been deprecated.
How to Debug java Script Error Using Firebug?
Duplicate
How can I set breakpoints in an external JS script in Firebug
Debug using FireBug.
Just check the line on which the error is occuring, then, just before that line, write a "debugger" call.
debugger; //Will invoke FireBug's debugger.
var err = abcs; //Line containing error
To debug an error in firebug :
1- select inspect tab from menu
2- Set break point in the line that
causes error
3- Refrsh the page
4- use F10 to step by step debug and
F5 to end debgging
It's like debgging of visual studio
Use the console.log(yourObject) function to output anything to the firebug console. It is just like running a var_dump and you can view all your objects and their contents. This is very helpful if you want to check on the contents of a particular variable or even a particular DOM object.
Instead of using cheap alerts - the console.log() function is cleaner and you can see all the outputs neatly in your console pane.
Note however you need to remove all references to the console.log function when you deploy your website as it would not run in IE.
you can put breakpoints in the code, and wait for the execution to hit them. Then you can walk in the code, and use watches to know the values of variables.
You can use Firebug, and for debugging in chrome, you can use firebug lite
Why Firebug , try Visual studio , it has a rich debugging features ;)