Search code examples
javascript.htaccessflexpaper

Trying to limit access to SWF files with FlexPaper


I'm trying to prevent users from downloading or accessing SWF files on my server. Using FlexPaper, the embed code looks something like this:

$('#documentViewer').FlexPaperViewer({ config : {
    SwfFile : 'swf/File.swf',
    // etc.
}});

The problem is, obviously, that people can view the source and go directly to the swf file, which I'm trying to prevent. Is there any way around this?


Solution

  • Rule #1 of the internet - of you don't want people "stealing" it, don't put it online.

    That being said, you can set up a file proxy, where the file is outside of the web root. A request is make to a server-side file with the filename which then spits out a MIME header and streams your file. How you do this depends on your server-side language preferences.

    It would look something like this:

    SwfFile : 'serveFile.php?File.swf',
    

    There are many plug-ins that will allow people to save the file to their local systems from the page, regardless of what you do so you need to balance your efforts against the forces of futility.