The Naked Scientists

The Naked Scientists Forum

Author Topic: How do I link upward from a Web page?  (Read 3065 times)

Offline Atomic-S

  • Hero Member
  • *****
  • Posts: 935
  • Thanked: 19 times
    • View Profile
How do I link upward from a Web page?
« on: 21/03/2012 04:05:13 »
I understand that to make a link from within a web page to another, one can include an absolute reference like HREF="http://any-web-site.com/page1.html" . If one is the web master of any-web-site.com , the person would simply use HREF="page1.html" (within the calling page, which could be page2.html).  If the page to be linked to is in a subfolder of the same site, then a relative reference of this form is used: HREF="subfolder/page3.html" .  So far, so good, But here is where things get complicated: What if the calling page is already in the subfolder, but the called page is in the root folder? I.e., calling from http://any-web-site.com/subfolder/page3.html to http://any-web-site.com/page1.html ?
I have looked through my book but I can find no format to do this using a relative expression. Is a relative expression possible, for linking up the chain into the root folder; or must the entire absolute URL be specified in orde to do this?


 

Offline nicephotog

  • Sr. Member
  • ****
  • Posts: 387
  • Thanked: 7 times
  • H h H h H h H h H h
    • View Profile
    • Freeware Downloads
Re: How do I link upward from a Web page?
« Reply #1 on: 21/03/2012 06:35:56 »
Windows server
href="..\page.html"

UNIX server
href="../page.html"

The two dots mean "directory above"

and one dot for each "dir" above but generally a system only supports 3 dots at the most so after that you must be aware where the "referrer" this.url or this.location or this.parent.location is in javascripting.
With server side scripting such as PHP PERL or JSP the exact location of dynamic pages can be found and used to produce the URL level required.
« Last Edit: 21/03/2012 06:39:26 by nicephotog »
 

Offline Atomic-S

  • Hero Member
  • *****
  • Posts: 935
  • Thanked: 19 times
    • View Profile
Re: How do I link upward from a Web page?
« Reply #2 on: 27/03/2012 05:00:08 »
Thanks; this is helpful. Also I did not know that there is a difference here between Windows and Unix servers, which might explain a few other things.
 

Offline nicephotog

  • Sr. Member
  • ****
  • Posts: 387
  • Thanked: 7 times
  • H h H h H h H h H h
    • View Profile
    • Freeware Downloads
Re: How do I link upward from a Web page?
« Reply #3 on: 31/03/2012 04:22:02 »
Plenty, with Win you must write (binmode) pragma on a file handle in PERL and assign binary file open for read - write or you damage the system. flock16 does not exist. and as for
paths both win and unix are / forward slash in web pages.
 

The Naked Scientists Forum

Re: How do I link upward from a Web page?
« Reply #3 on: 31/03/2012 04:22:02 »

 

SMF 2.0.10 | SMF © 2015, Simple Machines
SMFAds for Free Forums