Cocoa Design Patterns
Learning OpenGL ES for iOS
Presentations
Buy at Amazon Now
  • Cocoa Design Patterns
    Cocoa Design Patterns
    by Erik M. Buck, Donald A. Yacktman
  • Learning OpenGL ES for iOS: A Hands-on Guide to Modern 3D Graphics Programming
    Learning OpenGL ES for iOS: A Hands-on Guide to Modern 3D Graphics Programming
    by Erik M. Buck
« Green-Screen Video Effects for iOS: Video Processing with OpenGL ES | Main | Exploring GLKit for Mac OS X 10.8 Mountain Lion »
Sunday
Aug262012

Downloading Keynote Presentations Exported as HTML

When you export your Keynote presentations as HTML, Keynote generates a file named index.html and a folder named assets. The index file contains HTML code to open your favorite browser and display your presentation. The assets consist of you presentation slides rendered as images and some complicated javascript that implements animation and a "Heads Up Display" (HUD) for controlling the presentation with forward and back buttons etc.

If you plan to provide your presentation to other people, the obvious and naive approach is to compress the index.html and assets folder using Finder's compress context menu. Then upload the resulting .zip file to your favorite file sharing site such as a university courseware server. As far as that goes, so far so good. Unfortunately, there is a fatal flaw in this approach.

When Safari and other Mac OS X browsers download files including .zip files, a special "Extra Attribute" is added to each file indicating that it was downloaded. This is a security precaution to prevent execution of code downloaded from untrusted sources. This prevents script viruses and other nastiness. Unfortunately, the extra attribute prevents the javascript of the presentation from executing correctly. Apple's safeguard breaks your presentation.

The long term fix is for Apple to enhance the generated javascript code to be tolerant of extra attributes on files and perhaps request confirmation from the user that it's OK to execute the javascript for the presentation. Until Apple implements the enhancement, the best approach I have found to fix the problem is to remove the extra attributes that were added when the file(s) were downloaded.

In a terminal window, cd to the directory containing the downloaded .zip file. Then execute the command

>xattr -d com.apple.quarantine <your zip file name>.zip

to remove the extra attribute. When the .zip file is later uncompressed, the presentation will work. If you have already uncompressed the .zip file, you can recursively remove the extra attributes from all affected files by cd-ing to the folder containing the uncompressed files and executing the following command:

> find . -exec xattr -d com.apple.quarantine {} \;

However, none of these commands are likely to help the sad individual who naively downloads your presentations. The extra attributes are added by the end user's computer when the files are downloaded. It's not reasonable to expect everybody who wants to view your presentation to execute terminal commands. For that reason, Apple's current implementation of HTML export from Keynote is borderline useless for network distribution.

The best alternative is to export as PDF, but then, animations don't work, file sizes explode, and links occasionally get broken.

Reader Comments (1)

Thanks for sharing such a wonderful article.
November 20, 2015 | Unregistered CommenterHkumar

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.