greasemonkey insert javascript

Posted by Kaartz on Stack Overflow See other posts from Stack Overflow or by Kaartz
Published on 2010-05-24T17:39:52Z Indexed on 2010/05/24 17:41 UTC
Read the original article Hit count: 212

Filed under:
|

I have a bookmarklet, clicking the bookmarklet includes a PHP script (evaluated as a JavaScript file) to the page few table values and select values passed as GET parameters. The PHP script writes the page data to the MySQL database, and outputs a success message that is treated as JavaScript code and executed by the browser. Is there any possibility to do this using greasemonkey and call this function when a existing button is clicked on the web page.

I wrote the above bookmarklet inspired by this tutorial.

http://tutorialzine.com/2010/04/simple-bookmarking-app-php-javascript-mysql/

This is the bookmarklet code:

(function () {
var jsScript = document.createElement('script');

jsScript.setAttribute('type', 'text/javascript');

jsScript.setAttribute('src', '/bookmark.php?url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title));

document.getElementsByTagName('head')[0].appendChild(jsScript);
})();

Please help me.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about greasemonkey