LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 January 27 2010

patrick
Member

Retrieving url links

Well, the problem here, I would like to create an addon , that would retrieve the url of each page i browse, put it in a variable, then save it into another page...


I thought maybe i'd use java script or php using location.href , but i m not sure it would work.
Is there any more simple way to do it ?

Offline

#2 January 27 2010

patrick
Member

Re: Retrieving url links

<SCRIPT language=javascript>

{

document.write(window.location.href);


}
</SCRIPT>

Last edited by patrick (January 27 2010)

Offline

#3 January 28 2010

samer
Admin

Re: Retrieving url links

Your description is too vague. If I understood correctly you can create a bookmarklet (google it) that does this. You would have to click that bookmarklet to execute the javascript code on each new page .

Keep in mind that PHP is executed server-side, so unless you have a webserver running on your machine, it's stupid to do it in PHP.

Offline

#4 January 28 2010

patrick
Member

Re: Retrieving url links

Edit:


I was probably think of doing a firefox addon using greasemonkey ,

with my js code inside an html page.


The problem is, suppose i m on this page, my code will write the following :

http://www.lebgeeks.com/forums/edit.php?id=30825

But when I jump to another page ,

my code will replace the other link with the new one.


I just want it to increment the links, one after the other like this :

http://www.lebgeeks.com/forums/edit.php?id=30825 <br> 
http://www.lebgeeks.com/forums/edit.php?id=30826

Last edited by patrick (January 28 2010)

Offline

#5 January 29 2010

samer
Admin

Re: Retrieving url links

Let your greasemonkey script keep a temporary variable to which you append your links. Then inject the content in the page (or whatever it is that you're aiming to do). I've never fiddled with Greasemonkey so I might be wrong :)

Offline

#6 January 29 2010

patrick
Member

Re: Retrieving url links

Thank you Samer for your help.

And btw, If I ever forgot to say it, Happy birthday salaf

Offline

#7 January 29 2010

samer
Admin

Re: Retrieving url links

patrick wrote:

Thank you Samer for your help.

And btw, If I ever forgot to say it, Happy birthday salaf

You're welcome!
Hehe, it's in a few days, yes. Thanks!

Offline

Board footer