• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Can I add a piece of code to every page in a directory automatically?

In Dreamweaver, I can select some code and replace it with something else directory-wide by choosing the Find In: Folder... option in the Find and Replace box.  Awesome.

Now I need to add a reference to a JavaScript file to every page in my site.  How can I do this?  The line of code is:

<script type="text/javascript" src="/js/offsiteAlerter.js"></script>

It just needs to be anywhere in the <head> of the document.  Is there a way to find the <head> of every page and add it?

Also, I do not have a site defined in Dreamweaver.
0
mrcoulson
Asked:
mrcoulson
  • 2
2 Solutions
 
glumlunCommented:
why not replace:
</head>
With:
<your script reference>
</head>
Using dw or and text replace application

Glum.
0
 
mrcoulsonAuthor Commented:
I guess I wanted to keep all of the script tags in one place.  I mean, I'd rather settle for that solution than pasting it manually in a few hundred places tonight.
0
 
Jason C. LevineNo oneCommented:
mrcoulson,

Don't let the perfect stand in the way of the good.  glum's answer is how I would do it...
0
 
mrcoulsonAuthor Commented:
Well, heck!  You're a genius, so it must be right!

But it's good advice.  I guess I just want to avoid our new site becoming a jumble of unrelated code like the current site is; however, I ain't makin' no stinkin' overtime here tonight and may as well shorten one task if I can, right??

Thanks, guys!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now