View Full Version : Inserting .js include on every htm file in website
timveer
12-14-2007, 06:05 AM
Hi,
Had a wondering (trying to save time actually). I am using Frontpage (ok, ok, I know what you're going to say, but I've used it so long I'm addicted - it's kind of like a cigarette addiction - no benefits but you just keep doing it...:eek:)
OK, back on track. I want to add a .js include on every htm page in the file. Any ideas how to do this without using an absolute http://... location for the .js file? The problem is that if I do a "Find & Replace" to replce the </head> tag with the code + the </head> take, there is no consideration given to the folders location, recursiveness, etc.....
Any thoughts?
Tim
jscheuer1
12-14-2007, 07:28 AM
What's wrong with using the absolute path?
TimFA
12-14-2007, 08:18 AM
I don't like to use them either, but they do sometimes make it easier (absolute paths). You can use these:
../ = go back a directory, ../../../, etc.
for staying in current, just type in the name.
example:
------images------------------------------folder3(../../css/css.css)
index.html(images/image.jpg)
------css------------------folder2(../images/image.jpg)
I think that explains it. The farthest one is deepest in, I know its not efficient, but I think it should do.
jscheuer1
12-14-2007, 09:25 AM
Also, a single preceding slash means the root, so instead of:
src="http://www.somedomain.com/scripts/myscript.js"
you can:
src="/scripts/myscript.js"
It means the same thing.
timveer
12-14-2007, 06:09 PM
Thanks all for your input.
The reason that I didn't want to hard code an absolute is that I wanted to keep it as portable as possible, if I use forwarding or want to copy a few pages into another website.
Just an additional note to John's comment: According to another reply on a Frontpage forum, if you use the leading "/" this will start from te root, however if you are using a "Disc based" web, such as when previewing in FP or DW, it will fail as the "/" will direct back to the root of the disc, not the root of the webs directory.
Again thanks to all for a helpful forum!!:D
I am using Frontpage (ok, ok, I know what you're going to say, but I've used it so long I'm addicted - it's kind of like a cigarette addiction - no benefits but you just keep doing it...)Then quit :-\
jscheuer1
12-14-2007, 06:21 PM
More about /
All path conventions have limitations. The relative path will often fail if the page is moved. The absolute path is no good locally for testing local resources, it will grab the resources from the web. If you use a unique drive for web testing, and put the root files in the root directory and build from there, / will work out quite well both local and remote.
For my own work, I usually use relative paths though, and not FP, &@#!#.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.