GM_openInTab (or any other GM_ function) is not defined?

KXNV-89.1FM

When my GM script does this:

var curTab = GM_openInTab(url);

it results in a 'GM_openInTab is not defined' JavaScript error in the Browser Console.

I also tried using var curWin = window.open(url); instead of GM_openInTab but it had no affect.

What I'm trying to do with this GM script is: for a given website (domain name), go through a list (array) of URLs on this domain and look for items of interest.

What's wrong with my code or approach?

I'm using Greasemonkey 2.3 with Firefox 33.1.1 and Windows XP 32-bit.

Brock Adams

In order to use any of the GM_ functions, you must set a matching @grant directiveDoc (As of Greasemonkey version 2.0Release notes)

For example:

// ==UserScript==
// @name     _YOUR_SCRIPT_NAME
// @include  http://YOUR_SERVER.COM/YOUR_PATH/*
// @grant    GM_openInTab
// ==/UserScript==

var curTab  = GM_openInTab ("http://pwnthemall.com/");

Note that this has the side effect of switching Greasemonkey's sandbox back on. See also:



Tampermonkey emulates most of this behavior as of version 3.9Release notes. But the current version (3.9.202) still attempts to guess appropriate values if @grant is not specified, so you won't necessarily see an error (yet).
Always use @grant anyway, for maximum compatibility and to future-proof your code.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

GM_getValue is not defined (in injected code)?

From Dev

delete buttons defined in other function

From Dev

My add-on, compiled from a Greasemonkey script that uses GM_ functions, does not work in Firefox version 31+

From Dev

How to create a user defined function in PHP exactly the same as str_replace(), without using any other built-in functions except for strlen()

From Dev

variable defined in one function and undefined in other typescript

From Dev

GM_setClipboard (and other GM functions) gives an error in a Firefox but not Chrome/Tampermonkey?

From Dev

Creating inputs in function, or any other method (Javascript)

From Dev

Any alternative to passing a range to a user-defined function?

From Dev

Creating a function passing its arguments to the Surv function (or any other)

From Dev

How to call a static JS function defined in other javascript file

From Dev

How to access functions just defined in literal in other function in same literal?

From Dev

Return ENUM(defined in one class) from member function of other class

From Dev

Matlab: modifying one field of defined structure in other used function

From Dev

Passing MyClass defined in header as function argument to other file

From Dev

How to call a static JS function defined in other javascript file

From Dev

Linker yells that my function from other file is not defined

From Dev

function defined in one file not found when calling from other file

From Dev

can't translate to any other language using gettext php function

From Dev

Any other option is there without using Oracle Analytical function

From Dev

PHP list() assign - trim before assign or any other function?

From Dev

Why is a Javascript function created with Function constructor unable to access other functions defined outside of it?

From Dev

Is there an in-built function defined to save the data in codemirror (other than the key map function)?

From Dev

How to use a variable inside a function which is defined (variable) in some other function within a class in python?

From Dev

Is there any way that i can perform sum instead of count using cut or any other function using R

From Dev

Is there any other less processor intensive way to limit the speed at which a function is called other than busy-waiting?

From Dev

Is there any other use of naming a function that is being assigned other than recursive calling itself?

From Dev

Is there any other less processor intensive way to limit the speed at which a function is called other than busy-waiting?

From Dev

I want to covert julian date(YYJJJ format) to any normal date format(MMDDYY) using c#. Is there any defined function for that?

From Dev

Google Sheets - Count unique / distinct values within QUERY function (or any other function, but not using pivot table)

Related Related

  1. 1

    GM_getValue is not defined (in injected code)?

  2. 2

    delete buttons defined in other function

  3. 3

    My add-on, compiled from a Greasemonkey script that uses GM_ functions, does not work in Firefox version 31+

  4. 4

    How to create a user defined function in PHP exactly the same as str_replace(), without using any other built-in functions except for strlen()

  5. 5

    variable defined in one function and undefined in other typescript

  6. 6

    GM_setClipboard (and other GM functions) gives an error in a Firefox but not Chrome/Tampermonkey?

  7. 7

    Creating inputs in function, or any other method (Javascript)

  8. 8

    Any alternative to passing a range to a user-defined function?

  9. 9

    Creating a function passing its arguments to the Surv function (or any other)

  10. 10

    How to call a static JS function defined in other javascript file

  11. 11

    How to access functions just defined in literal in other function in same literal?

  12. 12

    Return ENUM(defined in one class) from member function of other class

  13. 13

    Matlab: modifying one field of defined structure in other used function

  14. 14

    Passing MyClass defined in header as function argument to other file

  15. 15

    How to call a static JS function defined in other javascript file

  16. 16

    Linker yells that my function from other file is not defined

  17. 17

    function defined in one file not found when calling from other file

  18. 18

    can't translate to any other language using gettext php function

  19. 19

    Any other option is there without using Oracle Analytical function

  20. 20

    PHP list() assign - trim before assign or any other function?

  21. 21

    Why is a Javascript function created with Function constructor unable to access other functions defined outside of it?

  22. 22

    Is there an in-built function defined to save the data in codemirror (other than the key map function)?

  23. 23

    How to use a variable inside a function which is defined (variable) in some other function within a class in python?

  24. 24

    Is there any way that i can perform sum instead of count using cut or any other function using R

  25. 25

    Is there any other less processor intensive way to limit the speed at which a function is called other than busy-waiting?

  26. 26

    Is there any other use of naming a function that is being assigned other than recursive calling itself?

  27. 27

    Is there any other less processor intensive way to limit the speed at which a function is called other than busy-waiting?

  28. 28

    I want to covert julian date(YYJJJ format) to any normal date format(MMDDYY) using c#. Is there any defined function for that?

  29. 29

    Google Sheets - Count unique / distinct values within QUERY function (or any other function, but not using pivot table)

HotTag

Archive