Hi! I have been using a website that takes forever to load and has several other issues. I want to generate links and force them to open in browser. How can I do it (preferably in processing). I would prefer for it to be editable, since there is a start point for generating.
Thank you!
1 Like
I’m afraid that the question is not clear… do you want to show hyperlinks on a Processing sketch?
2 Likes
thank you for replying. I want to create a sketch that when run opens n links in browser. The links numbered, so whenever I run them, I need to specify where to start. So if I put 200 and n=5, it will open 200,201,202,203,204. (in format: www.randomWeb.com/content/page/c-[number])
For reference, here is an example that loads three pages from Project Guttenberg corresponding to three sequential id books:
/**
* BatchLinkOpener
* 2021-09-05 Jeremy Douglass - Processing 3.5.4
* https://discourse.processing.org/t/how-to-force-chrome-to-open-a-link/31617
*/
String baseurl="https://www.gutenberg.org/ebooks/";
int start = 1341;
int count = 3;
void setup() {
for(int i=0; i<count; i++) {
// DO NOT call link in draw unless you are very careful --
// if you spawn 60+ tabs per second your browser may freeze.
link(baseurl + str(start+i));
}
}
As the snippet says, DO NOT call link()
from draw()
unless you are extremely careful. You can nuke your browser and potentially freeze your desktop if you accidentally start spawning 60+ tabs per second from your sketch. Handle with care.
2 Likes