1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<helpdocument version="1.0">
<meta>
<topic id="textsharedguidehyperlink_rel_absxml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">Relative and Absolute Links</title>
<filename>/text/shared/guide/hyperlink_rel_abs.xhp</filename>
</topic>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3147399"><bookmark_value>absolute hyperlinks</bookmark_value>
<bookmark_value>relative hyperlinks</bookmark_value>
<bookmark_value>hyperlinks; relative and absolute</bookmark_value>
<bookmark_value>hyperlinks, see also links</bookmark_value>
</bookmark>
<paragraph role="heading" id="hd_id3147399" xml-lang="en-US" level="1"><variable id="hyperlink_rel_abs"><link href="text/shared/guide/hyperlink_rel_abs.xhp" name="Relative and Absolute Links">Relative and Absolute Links</link>
</variable></paragraph>
<paragraph role="paragraph" id="par_id3153345" xml-lang="en-US">When you include hyperlinks, two factors must be taken into account: whether they are set as relative or absolute on saving, and whether or not the file is present.</paragraph>
<list type="unordered">
<listitem>
<paragraph role="listitem" id="par_id3147008" xml-lang="en-US">Choose <switchinline select="sys"><caseinline select="MAC">%PRODUCTNAME - Preferences</caseinline><defaultinline>Tools - Options</defaultinline></switchinline> - <link href="text/shared/optionen/01010200.xhp" name="Load/Save - General"><emph>Load/Save - General</emph></link> and specify in the <emph>Save URLs relative to</emph> field if $[officename] creates <link href="text/shared/00/00000005.xhp#saving" name="relative or absolute hyperlinks">relative or absolute hyperlinks</link>. Relative linking is only possible when the document you are working on and the link destination are on the same drive.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3145382" xml-lang="en-US">You should create the same directory structure on your hard disk as that which exists in the web space hosted by your Internet provider. Call the root directory for the homepage on your hard disk "homepage", for example. The start file is then "index.html", the full path being "C:\homepage\index.html" (assuming Windows operating system). The URL on your Internet provider's server might then be as follows: "http://www.myprovider.com/mypage/index.html". With relative addressing, you indicate the link relative to the location of the output document. For example, if you placed all the graphics for your homepage in a subfolder called "C:\homepage\images", you would need to give the following path to access the graphic "picture.gif": "images\picture.gif". This is the relative path, starting from the location of the file "index.html". On the provider's server, you would place the picture in the folder "mypage/images". When you transfer the document "index.html" to the provider's server through the <emph>File - Save As</emph> dialog, and if you have marked the option <emph>Copy local images to Internet</emph> under <switchinline select="sys"><caseinline select="MAC"><emph>%PRODUCTNAME - Preferences</emph></caseinline><defaultinline><emph>Tools - Options</emph></defaultinline></switchinline><emph> - Load/Save - HTML Compatibility</emph>, $[officename] will automatically copy the graphic to the correct directory on the server.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3159158" xml-lang="en-US">An absolute path such as "C:\homepage\graphics\picture.gif" would no longer function on the provider server. Neither a server nor the computer of a reader needs to have a C hard drive: operating systems such as Unix or macOS do not recognize drive letters, and even if the folder homepage\graphics existed, your picture would not be available. It is better to use relative addressing for file links.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3154046" xml-lang="en-US">A link to a web page, for example, "www.example.com" or "www.myprovider.com/mypage/index.html" is an absolute link.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155450" xml-lang="en-US">$[officename] also reacts differently, depending on whether the file referred to in the link exists, and where it is located. $[officename] checks every new link and sets a target and protocol automatically. The result can be seen in the generated HTML code after saving the source document.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3145317" xml-lang="en-US">The following rules apply: A relative reference ("graphic/picture.gif") is only possible when both files exist on the same drive. If the files are on different drives in your local file system, the absolute reference follows the "file:" protocol ("file:///data1/xyz/picture.gif"). If the files are on different servers or if the target of the link is not available, the absolute reference uses the "http:" protocol ("http://data2/abc/picture.gif").</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3153541" xml-lang="en-US">Be sure to organize all files for your homepage on the same drive as the start file of the homepage. In this way, $[officename] can set the protocol and target so that the reference on the server is always correct.</paragraph>
</listitem>
</list>
<paragraph role="warning" id="par_id3153897" xml-lang="en-US">When you rest your mouse on a hyperlink, a help tip displays the absolute reference, since $[officename] uses absolute path names internally. The complete path and address can only be seen when you view the result of the HTML export, by loading the HTML file as "Text" or opening it with a text editor.</paragraph>
<embed href="text/shared/00/00000004.xhp#related"/>
<embed href="text/shared/guide/hyperlink_edit.xhp#hyperlink_edit"/>
</body>
</helpdocument>
|