Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Import web page does not fix javascript links

Try importing a roll-over menu from MacroMedia Fireworks.

Citydesk only sees the pictures directly available in the HTML file; not those called from javascript. The trouble is updating multiple pictures and finding all the magic names by hand.

Could you add something like 'aggressive link search' to the import function?

Adriaan van den Brand
Friday, May 3, 2002

Speaking as someone who tried to do this in a previous life... it's waaaaaaaaaaay harder than it looks on the surface. What a human can point at and say "look! image file" is not nearly as easy to pick up automatically. I've contemplated solutions for problems like this, and none of them are easy nor foolproof.

Brad Wilson
Friday, May 3, 2002

Just try importing a page with frames - it imports the page that creates the frames... Just because it previews doesn't mean it will get pulled in.

Linkbot ( ) was always good at picking these things out... A really robust regular expression should do it.

Friday, May 3, 2002

I know it is not easy; and no guarantees can be made. Hence my suggestion for something like "aggressive search". All names ending in .gif or .jpg are potential candidates.

Another option would be to load it in internet explorer and iterate through the page with javascript or so.

Anyway: there is room for improvement. As for the roll-over: if it can be repeated in an easy way it would not be too bad. Currently updating is very hard since all images may have new magic names.

Adriaan van den Brand
Saturday, May 4, 2002

What about this bit of pseudo-code:

for(i = 1 to 25)
  myNewFile = "foo-" + string(i) + "-bar.jpg";
  someImage[i].src = myNewFile;

I see variations on this all the time in JavaScript (especially in roll-over cases). You just can't get the filename without running the code.

Perhaps the "best" solution I've seen so far is an "interactive watcher". It sets itself up as a proxy server through which all the web requests go (trivial when embedding IE). Then you give it the URL. It intercepts every request (which means you need to make sure your cache is clear), even after the page is loaded. The user is encouraged to "interact" with the page, such as rolling over images that have roll-overs, etc.

Of course, making pages that aren't so obnoxious is an even better idea. ;)

Brad Wilson
Saturday, May 4, 2002

*  Recent Topics

*  Fog Creek Home