Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Avoid Common Pitfalls in Greasemonkey
Subject:   Another way for calling Remote Page Scripts
Date:   2006-08-14 15:24:19
From:   .::jp::.
I'm new with greasemonkey and i've been using another way for calling Remote Pages Scripts, making use of "window.location.href", example:


Calling a function:


window.location.href="javascript: RemotePagefunction("+arguments+")";


Changing a var:
window.location.href="javascript: void(localvar='foo')";


With this method you can't receive parameters from the function.

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Another way for calling Remote Page Scripts
    2006-12-13 04:53:31  PhiLho [View]

    You are reinventing bookmarklets... :-)
    I didn't tried, but can't you write:
    window.location.href="javascript: void(returnValue = RemotePagefunction("+arguments+")");
    to get the return value?
    • Another way for calling Remote Page Scripts
      2007-09-17 02:15:32  .::jp::. [View]

      I think yes, but to access the var "returnValue" you would need to use "unsafeWindow.returnValue", so once you use it the easiest option would be:

      var returnValue = unsafeWindow.RemotePageFunction(arguments);