Dreamweaver Pasting Error

I ran a strange error message today.

While executing onLoad in PasteFireworksHTML.htm, a JavaScript error occurred.

I’m not sure what caused it, but I did recently add and remove some programs. I searched the web, and found that many people have encountered this error, but few seem to have solved it very well. Most of the solutions related to Dreamweaver plugins, but I don’t have any installed. So, I dug into the issue myself.

A quick search found the file at C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Comands\PasteFireworksHTML.htm. This file contains a bit of Javascript in a <head> tag, and then <body onLoad="initialize()"></body>. This must be the onLoad event that is failing.

I used Dreamweaver’s search-in-files functionality to search for the definition of initialize, and found it in the aptly named PasteFireworksHTML.js. Here’s what that function looks like:

function initialize() {
  var validFWFile = false;
  var fwSource = dw.getClipboardText();
  if (fwSource && isFireworksHTML(fwSource)) {
    validFWFile = true;
      MM.event.handled = pasteFWHTML();
    MM.event.handled = false;

I tried wrapping the whole function in a try { ... } catch(ex) {}, but that didn’t seem to affect anything. I even restarted DW and tried again. Same error.

I put alert("initialize!"); in the function, but never got the alert. Very strange.

So, I pulled up PasteFireworksHTML.htm, and put this in the script block at the top: alert(initialize.toString());. Sure enough, the second I saved the file, I got an alert with the code of the initialize function, and got the alert that just said “initialize!”

I stripped out the alert from PasteFireworksHTML.js, and saved the file. Didn’t change the behavior. However, then I changed PasteFireworksHTML.htm (added and then deleted a character,) and saved it, and the behavior changed — the “initialize!” alert went away. Apparently, it only processes the JS file when the HTM file is saved.

I stripped out my try/catch, and the alert from PasteFireworksHTML.htm, and saved the JS and then the HTM file. Now it works fine.

Interestingly, this process left the two files in exactly the same condition that they were in before, but somehow got DW to realize that they’re not broken. My theory is that some program updated them in the wrong order, leading to some kind of strangeness. Simply opening, modifying, and saving the PasteFireworksHTML.htm file would have done the trick, even if it left both files unchanged.

Hopefully this solution will help the next hapless soul who runs into this problem.

4 Responses to “Dreamweaver Pasting Error”

  1. On January 1st, 2007 at 10:29:24, pwsquare Said:

    Thanks a bunch! This really helped, I just save the file, and the error went away.

  2. On January 7th, 2007 at 16:42:24, ablemike Said:

    This worked for me. All I did was type a space and delete it then saved both the .js and the .html!


  3. On March 16th, 2007 at 14:33:53, Adam Patten dot com » Blog Archive » Dreamweaver Pasting Error Said:

    [...] also receiving this error message fear not, Isaac Schlueter has already done all the dirty work and figure it out for [...]

  4. On April 27th, 2007 at 21:10:55, Eaf Said:

    Yes, that did work, but around the same time I began receiving those errors, I realized that my ‘Undo’ button wouldn’t work. I tried the short-cuts that were placed by default (ctrl-z, alt-bksp) and then I tried ‘Menu -> Edit =>’ Undo which also did not work. I also attempted to edit the keys for ‘Undo’ but to no prevail.

Leave a Reply

Comments are moderated like crazy using a variety of plugins. There is a very high likelihood that your comment won't show up right away, especially if you have never commented here before, but it was not deleted.

Please be patient, and do not post your comment more than once. It will show up once it is approved.

You must be logged in to post a comment.