Editing webarchives...?

Joined
Jan 7, 2008
Messages
5
Reaction score
1
Points
3
How do you edit these things? For example, right now in Safari I can save this webpage as a .webarchive file and open it with Safari, but how can I edit it? I can open the page up in TextEdit but the format is all screwed up, is there an app I can download that will open .webarchive files as they are and let me edit some text around (I'm thinking something similar to how FrontPage is implemented with Explorer?)
 
Joined
Jun 5, 2009
Messages
3
Reaction score
0
Points
1
Editing webarchives

Try this for a WebArchive extractor!

"WebArchive Folderizer"

Then you can find the html file inside it and edit it with your preferred text or HTML editor.

For instance, I wanted to save a GMail message with a clean layout, so I clicked Print in GMail, but cancelled the print and saved the message as a webarchive. Then I opened the webarchive in Safari and it immediately relaunched the Print dialog!

So, I used "WebArchive Folderizer.app" to extract everything into a subfolder. Then I found a file called "Dynamic html 1.html" and searching it I found the following:

<script>
function Print(){document.body.offsetHeight;window.print()}
</script>
</head>
<body onload="Print()">


which of course I need to change to:

</head>
<body>
 
Joined
Jun 5, 2009
Messages
3
Reaction score
0
Points
1
Of course, the problem now is that the links to previously embedded material don't work, that is, the relative addressing does not seem to work once the files are in a folder versus in the webarchive!

Here is the problem. The links (such as "<a href=" something or other) are able to use "/" at the beginning of the url, because the webarchive behaves like a separate domain! In the folder, it is in your file system, and "/" refers to the root of your hard drive! To fix that you would need to remove all of the leading "/"'s but also maybe add a "../" instead, to point back to the parent directory of the current html file!

Surely a neater solution, to our tiny edit, would be to be able to replace the original html file INSIDE the webarchive with our modified one?

Does anyone know of a thing similar to Webarchive Folderizer, but in reverse? Or a utility which can simply enable us to "Show Package Contents" exactly like we can to a Mac application (.app file)! That way we could simply do that tiny edit and be done with it!
 
Joined
Jun 5, 2009
Messages
3
Reaction score
0
Points
1
On another tack. The basic word processor "Bean" in fact can directly edit (in a WYSWYG way) webarchive files. I just figured that as I wouldn't be able to see the javascript in my previously saved file I wouldn't be able to remove it. I have previously regularly used Bean to strip out unhelpful objects from saved web pages. However, it may be best to save a COPY of the webarchive file before editing it with Bean, because it may automatically dump stuff it doesn't like from a page. That may be fine with you, but it may significantly change the layout of the page, such as dropping the entire side menu and site logos!

This was no problem with my saved e-mail page, so instead of using "WebArchive Folderizer" I ONLY opened it with Bean. In order to save the file I had to make a change. That could be adding a single space, but in this case I simply deleted the GMail logo. This made the file size drop from 16KB to 12KB (it may not have removed a full 4 KB from the file, but as the Mac file system operates in increments of 4KB, this is the difference it made, on disk).

I then reopened it in Safari, and lo and behold, no JavaScript!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top