0

I have a userscript which accesses a global variable from the website it is running. The variable is:

window.runParams.mainBigPic

The problem is that Firefox (compared to Google Chrome) does not allow access by default to the global variables, see here and here.

CloneInto() and so didn't work. Undefined. I have to use resource so can't switch to @grant none

// @resource jquiCSS https://code.jquery.com/ui/1.11.2/themes/blitzer/jquery-ui.css
// @grant GM_getResourceText
var jquiCSS = GM_getResourceText ("jquiCSS");
GM_addStyle (jquiCSS);

What way can i access the onsite-variable in my userscript AND use the external Css?

Community
  • 1
  • 1
Email
  • 2,395
  • 3
  • 35
  • 63
  • @Brock Adams thanks, this is indeed the SO question matching my issue. btw, thanks for being here at SO as the overguru of Userscripts. I now use unsafeWindow. Thanks for your detailed answer!!! – Email Mar 28 '15 at 00:07
  • 1
    You're welcome; glad to help. [Your other question](http://stackoverflow.com/q/29299952/331508) looks like it might be the same issue. Is it? If so, consider deleting it. If not, it needs enough info for us to replicate the problem. It's currently NTF, but we can't see `userscript.php?user=test&fo=bar`. – Brock Adams Mar 28 '15 at 00:29
  • @BrockAdams i deleted the other one. I experience problems with unsafeWindow when i add to script array like "desc_images.push(unsafeWindow.runParams.mainBigPic);". when accessing the desc_images array there comes "Error: Permission denied to access object" – Email Mar 28 '15 at 00:37
  • Interesting. Recent changes to GM and FF *may* be gumming up the works. If needed, open a new question and be sure to include an MCVE, as well as your FF and GM versions. – Brock Adams Mar 28 '15 at 00:45

0 Answers0