Greasemonkey Error Is Not Defined
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or
Gm_getvalue Is Not Defined
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss referenceerror: gm_getvalue is not defined Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only
Tampermonkey Gm_getvalue
takes a minute: Sign up Javascript: Function is defined, but Error says.. Function is not found ! (Strange) up vote 5 down vote favorite 2 This is my code : function mark() { alert("This is a test box.."); } setTimeout("mark()",5000); gm getvalue tampermonkey Error : Function mark() is not found !! There is some other issue.. as it works on http://jsfiddle.net/russcam/6EXa9/ but its not working in my application.. so can you help me debug this ? What else can be the reason.. By the way I am running this inside a GreaseMonkey script ! javascript javascript-events asynchronous greasemonkey share|improve this question edited May 7 '11 at 8:18 asked May 7 '11 at 7:48 Yugal Jindle 13.7k2583159 2 Is the function defined inside another gm_setvalue example function, by any chance? –Fyodor Soikin May 7 '11 at 7:51 what environment are you using? Works fine - jsfiddle.net/russcam/6EXa9 –Russ Cam May 7 '11 at 7:52 This is not working... for me.. I don't understand why ? The function is not inside any function, its global ! –Yugal Jindle May 7 '11 at 8:07 It should work.. but its not working ! –Yugal Jindle May 7 '11 at 8:08 By the way.. this is a part of grease monkey script.. if that makes a difference ? –Yugal Jindle May 7 '11 at 8:09 | show 1 more comment 5 Answers 5 active oldest votes up vote 9 down vote accepted If you are using GreaseMonkey, any functions you define are sandboxed by GM and not available in the main window. When you use any of the native functions however, like setTimeout or alert, they are called in the context of the main window e.g; when you call setTimeout you are actually calling window.setTimeout() Now the function you have defined, mark doesn't exist in the main window and what you are asking setTimeout to do is evaluate the string 'mark()'. When the timeout fires window.eval( 'mark()' ) is called and as discussed, window.mark is not defined. So you have a couple of options: 1) Define mark on the window object. GM allows you to do this through the unsafeWindow object like
Sign in Pricing Blog Support Search GitHub This
Gm_listvalues Is Not Defined
repository Watch 120 Star 1,184 Fork 224 greasemonkey/greasemonkey greasemonkey grant Code Issues 133 Pull requests 12 Projects 0 Wiki Pulse Graphs New issue
Tampermonkey Grant
Error: aForced is not defined #1517 Closed arantius opened this Issue Feb 11, 2012 · 0 comments Projects None yet Labels http://stackoverflow.com/questions/5919781/javascript-function-is-defined-but-error-says-function-is-not-found-stran None yet Milestone 0.9.17 Assignees No one assigned 1 participant Collaborator arantius commented Feb 11, 2012 From http://groups.google.com/group/greasemonkey-users/t/3cc178b4d1b39757?hl=en All of my GM scripts stopped working today. I get this same error on multiple pages where scripts should be running (youtube, FB, https://github.com/greasemonkey/greasemonkey/issues/1517 and this very page): Error: aForced is not defined Source File: resource://greasemonkey/script.js Line: 447 GM 0.9.16 on FF 9.0.1 arantius added a commit that closed this issue Feb 11, 2012 arantius … Fixes #1517 643fa57 arantius closed this in 643fa57 Feb 11, 2012 Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. Terms Privacy Security Status Help You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
a choice between GM_ functions and jQuery functionality // ==UserScript== // @name YOUR_SCRIPT_NAME // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @grant https://recalll.co/app/?q=greasemonkey%20and%20jquery%20get%20not%20working GM_getValue // @grant GM_setValue // @grant etc., etc. // ==/UserScript== $.get ('index.php', function () { console.log ('yay'); console.log ($(this).html () ); } ); So the $(document).ready() was the problem! I was sure http://userscripts-mirror.org/topics/213898 when I first started that I found several articles saying using .ready was the best way of ensuring your code ran when the page had finished loading. Goes to show how is not bad some of the 'knowledge' out their on the internet is. THanks Brock! Heh, still not working in the bit I need it to though. I have a link I insert into the page, I then use addEventListener document.getElementById('inserted-link').addEventListener("click",myFunction,true); but get will not work in myFunction. Everything else does - GM_set/get etc. None of that was in this question! Mark this question is not defined answered and then ask a new question with the full/correct information. Best to link to your target page, too. greasemonkey and jquery get not working - Stack Overflow View More at http://stackoverflow.com/questions/13506473/greasemonkey-and-jque... Your code works fine for me. Why/How do you think $.get is not working? Remember that you will never see the 'jQuery.get worked' message if there is a server error (404 etc.) with index.php. Did you check the Firebug Net panel, or Wireshark, etc. to see if the AJAX call was made? Anyway, you can see that code working, plus some error handling if you install this Greasemonkey script: // ==UserScript== // @name _delme9h762 // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @include http://fiddle.jshell.net/ZqhRH/* // @require http://code.jquery.com/jquery.js // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ function runMyFunc() { console.log('myFunc is called'); $.get('index.php', function () { console.log ('jQuery.get worked'); } ) .error ( function (respObj) { console.log ("Error! ", respObj.status, respObj.statusText); } ) .complete ( function (respObj) { console.log ("AJAX Complete. Status: ", respObj.status); } ) ; } $("#someHook").before('Link'); $('#myLink
24 posts, 5 voices SEARCH DISABLED search will be added soon Apr 9, 2014 2:22am [emailprotected].. Scriptwright I get this message every time I try to call GM_xmlHttpRequest(). Firefox 28, Scriptish 0.1.11. This line is used. [code]// @grant GM_xmlhttpRequest[/code] [code]ReferenceError: GM_xmlHttpRequest is not defined[/code] Apr 9, 2014 4:31am JoeSimmons Scriptwright It seems you have the capitalization wrong. It's GM_xmlhttpRequest not GM_xmlHttpRequest. I know... kinda dumb, lol. Apr 9, 2014 2:00pm [emailprotected].. Scriptwright Fuck! It costed me a like a hour. I just copied it from some site, lol. Now I have another problem : how to modify the page? document.write() doesn't work from userscript. $('html').appendChild(document.createTex tNode('a')); works from console but not from the userscript, even if I include jquery. scriptish] TypeError: $(...).appendChild is not a function Apr 9, 2014 2:14pm Watilin Scriptwright Because you’ve @granted an elevated function, your userscript doesn’t run in the page context anymore. To access its variables, use unsafeWindow. unsafeWindow.$('html').appendChild(document.createTextNode('a')); Anyway, you don’t need jQuery to do this. document.documentElement.appendChild(document.createTextNode('a')); Apr 9, 2014 2:20pm [emailprotected].. Scriptwright I removed all @grant, it works without too. Apr 9, 2014 2:53pm [emailprotected].. Scriptwright Is there any debug possibility except console.log() ? Apr 9, 2014 3:10pm Watilin Scriptwright Yes. The console object comes with a full API including console.info, console.warn, console.error and other useful methods. GreaseMonkey also provides GM_log which outputs to the browser console, not to be confused with the web console. To open the browser console in Firefox, hit Ctrl+Shift+J. Also, if you don’t aleady know about the JavaScript debugger, Firefox natively provides one