Results 1 to 6 of 6

Thread: Absolute and Relative Links in Firefox

  1. #1
    Join Date
    Apr 2005
    Location
    Sydney, Australia
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Absolute and Relative Links in Firefox

    Ok.
    please be really clear when replying - thanx

    I have a "website" or collection of htm folders on our shared computer.

    On my webpages, I will have links to other webpages.

    What is the best way to use relative links and be compatible for both IE and Firefox browsers (latest versions)?

    Or, if I use absolute links - what is the best way to specify this as the files aren't on a webserver, just our shared computer's harddrive.

    I've read somewhere that the forward and back slash are interpreted differently by different browsers, etc.

    The page currently loads an IFRAME with an applet which has a Table of Contents. Both tables load the page, but!
    The links work in IE, but not in Firefox

    I just want the page listing the links to be compatible with both browsers.

    thanx stax
    WIWAG

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    FF is a little more persnickety than IE. Both will be happy with absolute links as long as the drive has the same letter on both computers and you use the up (/) slash exclusively to denote directories. However, you also need to use this odd looking convention:

    <a href="file:///C:/webwork/mysite/index.html">

    Relative paths that work in one browser should work in another as long as, once again, the up (/) slash is used for directories.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by wishiwasageek
    I have a "website" or collection of htm folders on our shared computer.
    Is this collection always going to stay local, or is it something that will eventually be uploaded to a web server?

    What is the best way to use relative links and be compatible for both IE and Firefox browsers (latest versions)?
    Your 'normal' relative URL will be fine in any user agent.

    If you're referring to something in the same directory, then start with just the name of the file or subdirectory: "image/example.png". If the target is in a parent directory, or in a path that 'split off' higher up, then start with two dots (.): "../in-the-parent.html".

    Or, if I use absolute links - what is the best way [...]
    Absolute URLs are awkward to use in a local filesystem, so it's best to avoid them. Particularly if you might move files about, or place them on a server sometime in the future.

    I've read somewhere that the forward and back slash are interpreted differently by different browsers
    They will interpreted in the same way on the same system, but not necessarily between different systems. For example, a backslash means nothing in a Unix-based filesystem[1], unlike in Windows. In any case, URLs are separated by the forward variety, so you should always use them: you can't go wrong that way.


    The OP can ignore this...

    Quote Originally Posted by jscheuer1
    However, you also need to use this odd looking convention:

    <a href="file:///C:/webwork/mysite/index.html">
    It's not actually that odd, if you use it in full:

    Code:
    file://localhost/<drive>/<path>
    It's just like a regular URL, except that Windows systems introduce a drive specification, unlike Unix-based systems which have no concept of drives. Though some user agents don't need to specify the machine name (localhost, in this case), Opera requires it.

    Mike


    [1] Not quite true, but certainly a slash and backslash are not treated in the same way.

  4. #4
    Join Date
    Apr 2005
    Location
    Sydney, Australia
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Is the BASE url different in IE and Firefox ? No!...

    Ok, so far so good.
    (thanx for being gentle Mike)

    The files are probably going to stay on the shared drive till I get around to learning how to create/buying a site for whom only people who have registered can logon.
    Anyway I do sometimes move the files around or rename folderes so relative is easier for me.

    Important added info: we are using Windows based OS.

    Would it upset either browser if I used maybe a BASE url?
    The only thing is I don't want to specify the base with a drive letter as everyone currently uses something different to access the shared drive.

    When I open the page in IE, and ask for properties, it calls the URL:
    file://\\Server MainDirectory\ServerShared\MYFILES\start.htm

    When I look at the source in Mozilla is says that the URL is:
    file://///Server MainDirectory/ServerShared/MYFILES\start.htm

    so how do I set the base url?

    Does IE interpret the forward and back slash as the same for local (intranet)files? That is as an indicator of directory structure?


    Background
    The links in my Table of contents were created by HTML HELP so they were (automatically) created using the backslash \ .
    I would like to specify an alternative url (the software allows this) to point to a Firefox friendly url (presumably with the forward slash/)

    just not sure how to specify it given the above prob with the slashies.

    thanx for wading through this.
    WIWAG

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Generally, the / will be understood as either / or \, so try using just /. Also, generally, whatever FF likes, IE will tolerate, at least as far as paths go. so I'd try:

    Code:
    file://///Server MainDirectory/ServerShared/MYFILES/start.htm
    More telling than properties may be the address showing in Mozilla's address bar. If you can copy that and paste it into IE's address bar with good result, there is your answer.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Apr 2005
    Location
    Sydney, Australia
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanx stax everyone for clearing that up.

    Appreciate it.

    WIWAG

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •