Can't debug greasemonkey script using firebug or firefox debugger - javascript

I found two posts on this but still doesn't seem to be working. I don't see the user.js script in the drop down menu on either firebug or the built-in firefox debugger. I'm still just learning coding and couldn't figure out the workaround strategies. Any help would be greatly appreciated.
How to debug Greasemonkey script on Firefox 30?
How to debug Greasemonkey script with the Firebug extension?
Firefox 35.0

The only way I've found to debug greasemonkey scripts is to use the browser console to get clues and then add alerts in my code where I think the problem is... then if the alert doesn't show up I know the problem is earlier in the code. My code usually ends up looking kinda like this pseudo code:
var i = get.value.from.page
alert(i)
do stuff to i
alert(i)
if (i===5){
do this stuff
alert ("i equaled 5")
}
else{
do this stuff instead
alert("i didn't equal 5, it equaled "+i)
}
Yeah, it's messy and time consuming... but it works.

Related

IE 11 showing error when i clicking with jquery function

IE so much confusing me with some errors like this,
SCRIPT1002: Syntax error
File: jquery-2.1.4.min.js, Line:2 Column 2538
The weird thing is , on firefox and chrome running well and no error.
And some button with jquery click function is working.
I'm Using IE 11
Before this i'm using jquery-1.1.13.min.js and when i use jquery 2.0 it still running properly on firefox and chrome
I'm really new with cross browser so any info will helping me very much, thanks :)
For the record I had this error which only showed itself on IE when doing cross-browser testing of a big Javascript code change.
In my case the problem was a function definition which included what would be a default in any other language:
i.e. Function Foo(param1, param2, param3=false)
.. clearly this was a stupid bit of code .. but it took me a while to track down so this might help someone out there. Doesn't show up in Chrome, FF, or even Edge.
Mostly these errors are not problems of jQuery itself. The problem situates in code using jQuery or inserted into jQuery (callbacks or event functionalities). In my case I used $.ajax to load a remote page in a div element. In the page I loaded there where // comment tags in the javascript part. As IE is putting this content on one line, more code that as I wanted was commented and this created the error.
So if in our case us are using $.ajax maybe this can be an issue. Otherwise best thing to do is debugging the code that generates this error and look for code that is not supported by IE (the version you use). Look for functions passed trough to jQuery.

How to add my own script in Firefox?

I changed browser from Opera to FF.
At the beginning I don't want Greasemonkey or other plugin.
I want to add my own JavaScript to some site.
I found this topic:
Manually adding a Userscript to Google Chrome
I tried this method with some changes which seems obviously for FF to me, but it didn't work. It's difficult to debug what going wrong because I don't get any error messages.
Could you give me some advice what I should check?

Javascript tabifier not working in Chrome, but works fine on Firefox

I have little knowledge of javascript so I hope someone here could help me. The problem occurs on http://www.bestfreeandroidapps.com/ if you look on the right side there are 3 tabs with Categories, Comments and Recent Posts. When you click on them from Chrome, nothing happens (no errors in the console, just nothing), however it works fine in Firefox.
This theme uses a script calle Javascript tabifier from http://www.barelyfitz.com/projects/tabber/, however I even replaced the script on the theme with what was included in the original project and still doesn't work on Chrome. Does anyone have an idea of what might be wrong and why is this happening?
Thank you very much!
It works. I think its being cached by the browser, I've had similar problems lately. Restart browser/computer!

javascript / internet explorer 8 crazyness

I have a web page with javascript in it, everywhere it runs fine except ie8. When I load on IE8 my javascript is missing, so I turn on the developer tools and javascript console to debug it, refresh, and my javascript loads. It seems it only loads when I have previously enabled the JavaScript console.
Can anybody shed some light on this? You can view the page here
http://www.orchestra-agency.com/contentviewer_beta.php?cv=ORC_TWL_01&p=0
Does the page make any console calls, like console.log('foo'), without first making sure that console and console.log are defined?
A simple workaround: log() – A lightweight wrapper for console.log
More powerful version: JavaScript Debug: A simple wrapper for console.log
Does it work in FF without Firebug enabled? If not, I'd bet it's the console.log's that cause it.
Try loading this on the page header
<script type="text/javascript">
// IE fix
if(!window.console) {
var console = {
log : function(){},
warn : function(){},
error : function(){},
time : function(){},
timeEnd : function(){}
}
}
</script>
It removes the functionality of any console code you have. If it fixes the problem, you have to find and clean all of them from your code...
This happens when the browser tries to output to the console but it doesn't exist so it throws an exception and blocks all further javascript.... :S

alert because of one of JavaScript functions

In our application we have a lot of JavaScript functions and sometimes an "[object Error]" alert comes out from nowhere when using IE7. It happens sometimes. The problem is that I can't figure out which exact function is causing that error. Any hint on how I can debug this?
Thanks.
If you are using IE, then when there is an error in your JavaScript code, there will be an error indicator on the left bottom of the browser window, you can click it to see which line of the JS code goes wrong
base on this article, it is a bug in IE7
Go to the Developer Tools debugger and select Break on Error.

Categories

Resources