We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Using bookmarklets (javascript)
Page Index Toggle Pages: 1
Using bookmarklets (javascript) (Read 1144 times)
Using bookmarklets (javascript)
Apr 22nd, 2009, 11:09am
 
Just a little experimenting.

To use: export the sketch. Open the generated html file and click.

In Firefox, it even counts the link embedded in the <object> part of the page (in case you don't see the 3rd link it is talking about).


Code:

/*
* Bookmarklets are made of javascript, entered as if they are addresses
* This bookmarklet shows a message box with the number of links in the page the PApplet is embedded in.
*
* Bookmarklet from:
* http://www.bookmarklets.com/
*
*/

void setup() {
noLoop();
}

void mouseClicked() {

if (online) {

//Executed directly by browser
link("javascript:if(frames.length<1){alert('This page has ' + document.links.length + ' links.')}else{alert('The page has frames! Use version of bookmarklet for frames. (bookmarklets.com)')}");

}

}

void draw() {}
Re: Using bookmarklets (javascript)
Reply #1 - Apr 23rd, 2009, 2:06am
 
Amusing idea, I never thought of that! Smiley
Page Index Toggle Pages: 1