# Search and Replace CSS or Javascript on all pages at once

**URL:** <https://forums.realmacsoftware.com/t/search-and-replace-css-or-javascript-on-all-pages-at-once/34714>\
**Category:** RapidWeaver Classic\
**Created:** [September 14, 2020, 12:33pm UTC](https://forums.realmacsoftware.com/t/search-and-replace-css-or-javascript-on-all-pages-at-once/34714 "2020-09-14T12:33:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geo](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/geo/32/20228_2.png) [@Geo](https://forums.realmacsoftware.com/u/Geo)\
**Post date:** [September 14, 2020, 12:33pm UTC](https://forums.realmacsoftware.com/t/search-and-replace-css-or-javascript-on-all-pages-at-once/34714/1 "2020-09-14T12:33:45Z")

</div>

Hello Rapidweaver friends,

Is there a quick way to do a “search and replace” on each page of a website all at once?

In a website that has about 300 pages, I need to replace the same a few characters in the Javascript section of each page with different characters (but similar to each other). For example, replace all the “function Name()” with “function Age()”.

Doing a “search and replace” on each page is endless.

I do place most of the CSS and Javascript in the general code section of Rapidweaver. But not all of it as each page is a bit different.

Thank you for your guidance. And if such a feature doesn’t exist yet in Rapidweaver, a cross-page search and replace feature would be a welcome addition to future versions of RW.

George

---

<div class="post-metadata">

**Author:** ![peterdanckwerts](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/peterdanckwerts/32/22443_2.png) [@peterdanckwerts](https://forums.realmacsoftware.com/u/peterdanckwerts)\
**Post date:** [September 14, 2020, 1:13pm UTC](https://forums.realmacsoftware.com/t/search-and-replace-css-or-javascript-on-all-pages-at-once/34714/2 "2020-09-14T13:13:01Z")

</div>

No, it’s not possible. One possible solution for the future would be to import css or javascript which might change from external files. That way, one change would affect all relevant pages.

---

<div class="post-metadata">

**Author:** ![Geo](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/geo/32/20228_2.png) [@Geo](https://forums.realmacsoftware.com/u/Geo)\
**Post date:** [September 15, 2020, 12:51pm UTC](https://forums.realmacsoftware.com/t/search-and-replace-css-or-javascript-on-all-pages-at-once/34714/3 "2020-09-15T12:51:17Z")

</div>

Does your suggestion imply that I should import 300 .js external files, for each of the 300 pages of the website?

I lack knowledge and there must be a more straightforward way to do that. Note that since I read your reply, I looked into how to add an external .js file into my server, and although I haven’t yet managed to make it work (by observing the expected effects of the javascript code onto the page), I think I will eventually find the way to do it (any tip is welcome).

Here is the javascript code I was referring to. The URL must differ from page to page (it is actually inline HTML code in Javascript):

> function CopyToClipboard() {  
> prompt(“Embed this page to your site:”, “\<iframe src="[https://player.vimeo.com/video/457049772\](https://player.vimeo.com/video/457049772%5C)” frameborder="0" allowfullscreen\> ");  
> }

---

<div class="post-metadata">

**Author:** ![peterdanckwerts](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/peterdanckwerts/32/22443_2.png) [@peterdanckwerts](https://forums.realmacsoftware.com/u/peterdanckwerts)\
**Post date:** [September 15, 2020, 1:35pm UTC](https://forums.realmacsoftware.com/t/search-and-replace-css-or-javascript-on-all-pages-at-once/34714/4 "2020-09-15T13:35:28Z")

</div>

I’m almost entirely ignorant of javascript but I think you ought to be able to get it to insert the url of the page itself, so you’d only need one script for all the pages. With a bit of luck some javascript guru will let you know. See [https://www.w3schools.com/js/js\_window\_location.asp](https://www.w3schools.com/js/js_window_location.asp)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [October 15, 2020, 11:35pm UTC](https://forums.realmacsoftware.com/t/search-and-replace-css-or-javascript-on-all-pages-at-once/34714/5 "2020-10-15T23:35:28Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
