Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE equivalent for GM_setValue and GM_getValue (Greasemonkey storage)

I have made a script that runs with no glitch on Firefox. I'm retrieving some data from external domain in an iframe to insert them in the page by using setInterval()

I have tried to use Trixie, so that it runs in IE, but it seems that functions GM_getValue and GM_setValue were not defined.

I've added these replacement functions, based on cookies, but I can't get it to work in a cross-domain way : http://www.howtocreate.co.uk/operaStuff/userjs/aagmfunctions.js

The cookie is created, and the data stored, but it's only accessible from the iframe, not from the top document. Here is the basic structure I used : http://www.pastie.org/1889407
In test() I have access to the value stored with GM_getValue("destination",""), but it doesn't work inside function check().

1) Is there a way to make the cookie cross-domain?

2) Are there other ways to store data in IE in a cross-domain way? (I have briefly heard of Flash objects, but it doesn't seem quite a light solution...) Other implementations of these functions (getValue and setValue) are quite hard to find.

3) I'm using Trixie, maybe it's not the best solution, any advice on what plugin I should better use, to have those functions?

like image 691
Michael Lumbroso Avatar asked May 11 '11 16:05

Michael Lumbroso


1 Answers

Well, after trying many solutions, I finally found an answer.

I used IE7PRO, that includes functions PRO_setValue and PRO_getValue, that ended to work just fine.

My problem was that I tried to access the external domain on an iframe, which is not supported by IE7PRO apparently.

I just splitted my script into 2 user scripts : one for my domain, that check if new PRO_getValue are available, and the other one for the external domain, that saves the data. One tab for my page, one for the other and surprisingly, it worked like a charm.

It doesn't seem possible with Trixie or GM4IE, the only inconvenient is that IE7PRO is heavy, since the GM script support is just a small part of this extension.

like image 137
Michael Lumbroso Avatar answered Nov 11 '22 16:11

Michael Lumbroso