Forum Moderators: open

Message Too Old, No Replies

url history as links

         

jbhavin

4:17 am on Sep 1, 2003 (gmt 0)

10+ Year Member



i have to make a history by splitting the url , which blob helped out.

now, say if i move from abc.htm to xyz.htm,

i shld get abc->xyz, on the xyz.htm page, which also should be the link and so on, so history dhls be displayed , and should be made links

how do i go about

any help please

jbhavin

5:08 am on Sep 1, 2003 (gmt 0)

10+ Year Member



how will i get the url of the previous page in the current page.

like i naviagte from www.abc.com/index.htm to www.abc.com/xyz.htm

so i want "index.htm" when i am in xyz.htm

hope this one is clear!

tedster

5:33 am on Sep 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To help everyone understand this discussion, the previous discussion is here:

[webmasterworld.com...]

BlobFisk: What jbhavin is trying to achieve is to take the filename from the URL and write it to the page.

And there's also a reference to the code found here:

[webmasterworld.com...]

jbhavin

5:38 am on Sep 1, 2003 (gmt 0)

10+ Year Member



its not only printing the current page, but also the url of the previous page visited onto the current page!

like from xyz i move to abc and then to def

so on page def i require to print xyz->abc ->def, which are all links

now i am getting only the current page!

jbhavin

6:43 am on Sep 1, 2003 (gmt 0)

10+ Year Member



how do i get the previous url in the current page!, any help

tedster

7:55 am on Sep 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Javascript cannot pull the URL directly from the history list -- if it could, you would be able to read every page a visitor was on before they came to your site, and that would be one nasty security violation.

So if you must use javascript, first know that all js information is tied to the page itself, and every time the user loads the new page, the previous page's js variables and functions are re-set.

The only way I know to pass information to the next page with javascript is to add the needed data as a query string that is appended to the URL. Then javascript on the next page can read the url and extract the data from the query string.

You'll need to add something like this --?thispage.html -- to the end of every internal link on the page. You can do this manually within each anchor tag, or you can script it. So your link from abc.html to xyz.html will end up looking like this:

<a href="xyz.htm?abc.html">XYZ</a>

Then on xyz.htm you can use javascript to pull that information from the query string with a function like this:

thisURL = parent.document.URL
previousURL = thisURL.substring(thisURL.indexOf('?')+1, thisURL.length)

MonkeeSage

8:02 am on Sep 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could go one step back, if that is all that is needed...mabye something like:

document.write("<a href='" + document.referrer + "'>Previous Page</a>");

Jordan

jbhavin

8:38 am on Sep 1, 2003 (gmt 0)

10+ Year Member



i am quite new javascript! i am afraid couldnt get hold of everything u said tedster!

if i could have more of coding

basicaly i want history to be printed on the webpage.

its like whichevr page i go shld be displayed

say frm abc-xyz-def and again abc

abc-xyz-def-abc , so on.....

need it badly!