Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18198 > unrolled thread
| Started by | "Tony" <tony.johansson@inport.com> |
|---|---|
| First post | 2013-01-22 11:37 +0100 |
| Last post | 2013-01-23 09:53 +0200 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.javascript
Locate file in the website "Tony" <tony.johansson@inport.com> - 2013-01-22 11:37 +0100
Re: Locate file in the website Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-01-22 08:28 -0700
Re: Locate file in the website Danny <dann90038@gmail.com> - 2013-01-22 12:55 -0800
Re: Locate file in the website Osmo Saarikumpu <osmo@weppipakki.com> - 2013-01-23 09:53 +0200
| From | "Tony" <tony.johansson@inport.com> |
|---|---|
| Date | 2013-01-22 11:37 +0100 |
| Subject | Locate file in the website |
| Message-ID | <kdlq62$r2j$1@dont-email.me> |
Hello! I don't use ASP.NET but if I did I could use ~ do indicate the root directory for my website but now I only use html. So if I have html files under directory WebsiteRoot/html and javascript files under WebsiteRoot/Javascript and css files under WebsiteRoot/Style If I want to locate files is the only way to use relative adressing in this way <link href="../Style/InPort.css" rel="stylesheet" type="text/css" /> <script src="../JavaScript/jquery/jquery.js" type="text/javascript" /> //Tony
[toc] | [next] | [standalone]
| From | Martin Leese <please@see.Web.for.e-mail.INVALID> |
|---|---|
| Date | 2013-01-22 08:28 -0700 |
| Message-ID | <kdmb7r$182$1@dont-email.me> |
| In reply to | #18198 |
Tony wrote:
> Hello!
>
> I don't use ASP.NET but if I did I could use ~ do indicate the root
> directory for my website but now I only use html.
>
> So if I have html files under directory WebsiteRoot/html
> and
> javascript files under WebsiteRoot/Javascript
> and
> css files under WebsiteRoot/Style
>
> If I want to locate files is the only way to use relative adressing in
> this way
> <link href="../Style/InPort.css" rel="stylesheet" type="text/css" />
> <script src="../JavaScript/jquery/jquery.js" type="text/javascript" />
I use the <base> element for addressing
relative to a base. Something like:
<base href="http://your.web.site/">
<link rel="stylesheet" href="Style/InPort.css" type="text/css">
<script defer type="text/javascript"
src="JavaScript/jquery/jquery.js"></script>
Note that you are using XHTML, not HTML.
You could also specify the full paths for
absolute addressing.
Finally, you might get a better response from a
newsgroup concerned with HTML, perhaps:
comp.infosystems.www.authoring.html
--
Regards,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/
[toc] | [prev] | [next] | [standalone]
| From | Danny <dann90038@gmail.com> |
|---|---|
| Date | 2013-01-22 12:55 -0800 |
| Message-ID | <982327f6-bcb4-473b-9667-40b07ea5688e@googlegroups.com> |
| In reply to | #18198 |
to Tony Yes, relative addressing in relation to a common reference point is the better approach for flexibility, that way if you ever move the files elsewhere in the webserver, the addressing remains. Say you move the parent folder for both Style and JavaScript folders, the ../ will still apply no matter where in the webserver hierarchy they get dropped. There's always the <base href="SOMEURL"> element, which appends SOMEURL string to any relative path in the file.
[toc] | [prev] | [next] | [standalone]
| From | Osmo Saarikumpu <osmo@weppipakki.com> |
|---|---|
| Date | 2013-01-23 09:53 +0200 |
| Message-ID | <kdo4tq$8r1$1@speranza.aioe.org> |
| In reply to | #18198 |
On 22.1.2013 12:37, Tony wrote: > I don't use ASP.NET but if I did I could use ~ do indicate the root > directory for my website but now I only use html. You may use / to indicate the root, e.g.: > javascript files under WebsiteRoot/Javascript <script src="/JavaScript/jquery/jquery.js" type="text/javascript" /> But this syntax needs a server to resolve the base URL. -- Best wishes, Osmo
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web