Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 935
  • Last Modified:

Can I add HTML code to multiple pages at a time?

Hey Experts! I want to be able to "BULK" add html code to a number of pages at the same time. I ahve been told that it cannot be done. Does anyone know of a program or batch file that can edit multiple pages at one time. I have about 150 pages (mostly photos) that I want to add a "no right-click" html code to. Please assist ASAP! Thanks!
0
CHRS3000GT
Asked:
CHRS3000GT
  • 8
  • 5
  • 5
  • +1
1 Solution
 
Kiran Paul VJComputer EngineerCommented:
what is the code you want to insert? how many lines?
0
 
Kiran Paul VJComputer EngineerCommented:
you can use dreamweaver to replace a string in all the files in a folder.
0
 
CHRS3000GTAuthor Commented:
The code is this (Actually there is also another code for disable image toolbar):
1)

<script language=JavaScript>
<!--
 var message="Copyright 2007 : CorbetDearyPhotos.com";
 function click(z) {
  if (document.all) {
   if (event.button == 2) {
    alert(message);
    return false;
   }
  }
  if (document.layers) {
   if (z.which == 3) {
    alert(message);
    return false;
   }
  }
 }
 if (document.layers) {
  document.captureEvents(Event.MOUSEDOWN);
 }
 document.onmousedown=click;
// -->
</script>

and 2)

<META
HTTP-EQUIV="imagetoolbar" CONTENT="no">
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
CHRS3000GTAuthor Commented:
I us FrontPage. I am not a real fan of DreamWeaver. Probably cause I don't know how to use it to its full capability.
0
 
Kiran Paul VJComputer EngineerCommented:
ok, so you want to insert the new javascript and meta tag in head section right?

if you have dreamweaver do this (i dont have Frontpage in my machine)
open a file from your folder. Change to code view. Press Ctrl+F, Find and replace window will popup. In Find In : Select folder. Then browse for your folder in which your files are stored.
in Search:
select source code
In Find:
type <head>

In Replace paste this

<head>
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<script language=JavaScript>
<!--
 var message="Copyright 2007 : CorbetDearyPhotos.com";
 function click(z) {
  if (document.all) {
   if (event.button == 2) {
    alert(message);
    return false;
   }
  }
  if (document.layers) {
   if (z.which == 3) {
    alert(message);
    return false;
   }
  }
 }
 if (document.layers) {
  document.captureEvents(Event.MOUSEDOWN);
 }
 document.onmousedown=click;
// -->
</script>



In effect you are adding your meta tag and javascript after the <head>
I am sure a similar feature will be avaible in Frontpage also.

***
And  make sure you backup all files before doing this.
***
0
 
SheharyaarSaahilCommented:
put the code in an external javascript and name it, e.g. script.js
then define your html pages as a site in frontpage
after that use find and replace option to replace the line before what you want to add these lines, im sure it should be before </head> tag,

so you will find

</head> in all the pages of your site

and replace it with

<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<script type="text/javascript" src="script.js"></script>
</head>

*replace script.js with your own external javascript with the proper location

CAUTION:
make sure that you have a backup of the original pages elsewhere, as replacing is a non-undo thingie
0
 
Kiran Paul VJComputer EngineerCommented:
you can also create a js file and paste your javascript code there and include the file. This will be better i think, so if there is a change in code, you need to change it only in the js file not in all 150 html files

you can include a javascript like

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

so now the replace code will look like

<head>
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<script type="text/javascript" src="your_file.js"></script>


and the your_file.js will look like

 var message="Copyright 2007 : CorbetDearyPhotos.com";
 function click(z) {
  if (document.all) {
   if (event.button == 2) {
    alert(message);
    return false;
   }
  }
  if (document.layers) {
   if (z.which == 3) {
    alert(message);
    return false;
   }
  }
 }
 if (document.layers) {
  document.captureEvents(Event.MOUSEDOWN);
 }
 document.onmousedown=click;


0
 
CHRS3000GTAuthor Commented:
So I would create a java.js file in notepade or the like, and then add that file to the root of my website. Correct? Then I would put the line of code in each of the pages by using the find and replace command. Is this correct?
0
 
Kiran Paul VJComputer EngineerCommented:
yes
0
 
SheharyaarSaahilCommented:
you can use frontpage too to create the js, you just have to save it as a js file;

and its not at all necessary to put the file in the root directory, you can create a separate js folder to keep all your js files there too, just make sure that you give the right path and filename in your code :)
0
 
CHRS3000GTAuthor Commented:
FP does not allow me to put in more than one line in the Find and Replace function.
0
 
SheharyaarSaahilCommented:
what version are you using......im having FP2003 and i can put multiple lines in the Replace With box.
0
 
brundoCommented:
> FP does not allow me to put in more than one line in the Find and Replace function.

It does, you have to type <shift>+<enter>.

And the checkbox "Find in source code" has to be checked...
0
 
brundoCommented:
... and the third thing: you can play with Search options to replace the text in each file in your web site.

This is what I am going to do now - replacing minus sign with en-dash in all files... Bye ... :-))
0
 
CHRS3000GTAuthor Commented:
FP XP.
0
 
CHRS3000GTAuthor Commented:
brundo....sorry but shift enter does NOT work
0
 
SheharyaarSaahilCommented:
write the code somewhere, and then copy paste in the text box of Replace With
0
 
brundoCommented:
In FP 2003 it works ctrl+enter, too. I don't have FP XP, so I cannot test it there :-((

The third solution is to write your part of code where you want (notepad or a new page in FP) and copy it to the "Replace With" field of the Replace dialog box...
0
 
CHRS3000GTAuthor Commented:
Saahil...I tried that too, but when you paste it, it only pastes the 1st line of code. It seems that I am am going to have to invest in a different version of FP. OUCH!
0
 
brundoCommented:
CHRS3000GT and experts who have FP 2003 (as I do),

I've take a look around and I've found how the search and replace dialog box looked like in the FP XP: http://office.microsoft.com/en-us/frontpage/HA010563981033.aspx
In FP 2003 we enjoy more options :-))

CHRS3000GT,

I have two more ideas:

1. Copy your web site somewhere, go to some of your friends who have FP 2003, change what you have to and go back home :-))

2. Do what kiranvj suggested you in his last advice, change each <META HTTP-EQUIV="imagetoolbar" CONTENT="no">

into:

<META HTTP-EQUIV="imagetoolbar" CONTENT="no"><script type="text/javascript" src="your_file.js"></script>

and forget about the line break.

Not very nice, but it works because HTML doesn't see line breaks (in almost all cases).
0
 
SheharyaarSaahilCommented:
agree with "no line break" option :)
0
 
CHRS3000GTAuthor Commented:
Good option....I'll try, brundo!
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 8
  • 5
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now