It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Get variable from external page (Greasemonkey Ext)

Get variable from external page (Greasemonkey Ext)

Postby DoA on Mon Mar 07, 2011 9:27 pm

Hi guys,

I'm developing a greasemonkey extension & I need to pull in a variable from a page source to which I have no server access (only browser source code access).

Someone pointed me to this:

http://userscripts.org/scripts/show/85398
http://wiki.greasespot.net/Reading_Content_Globals

Here's the code (I'm trying to pull the 'file' variable:

Code: Select all
      <script type='text/javascript'>
      var s1 = new SWFObject(
         '/flash/jwplayer.swf',
         'player', '680',
         '560',
         '10.0.0',
         '/flash/expressInstall.swf'
      );
      s1.addParam('allowfullscreen','true');
      s1.addParam('allowscriptaccess','always');
      s1.addParam('wmode','transparent');
      s1.addVariable('file', 'http://s9.mysite.com/dev08/0/493/031/04679591046.flv/276m3j4f9nutwe0f9utwre5c2756ff/4D752F4C.flv');
      s1.addVariable('provider', 'http');
      s1.addVariable('mute', 'false');
      s1.addVariable('image', 'http://thumbnails.mysite.com/thumbnails/AE2D100.jpg');
      s1.addVariable('channel', '10706');
      s1.addVariable('plugins', 'gapro-2,ltas');
      s1.addVariable('gapro.accountid', 'UA-6635353-5');
      s1.write('mediaspace');
   </script>


And here's the portion of my greasemonkey extension (with various options I've tried)

Code: Select all
// ==UserScript==
// @name           Global Test
// @include       *
// @require        http://userscripts.org/scripts/source/85398.user.js
// ==/UserScript==

function got(name, value) {
  document.write('got new global named ', name, ' with value ', value);
}

/**
The following two examples work perfectly

read_content_global('secret1', got);
read_content_global('secret2', got);
*/

/** I've tried all of the following, none work
read_content_global(file, got);
read_content_global('file', got);

read_content_global('SWFObject.file', got);
read_content_global('s1.file', got);
read_content_global(s1.file, got);

*/


Can this be done? Do I have to use a regexp? Help please!

Many thanks
DoA
 
Posts: 3
Joined: Wed Sep 27, 2006 7:01 pm

Who is online

Users browsing this forum: No registered users and 5 guests