how to enable iFrame designMode in a local webpage without using the localhost server?

Posted by vjk2005 on Stack Overflow See other posts from Stack Overflow or by vjk2005
Published on 2010-03-16T11:41:21Z Indexed on 2010/03/16 11:46 UTC
Read the original article Hit count: 303

The code...

<html>
    <body>
        <iframe id="editableFrame"></iframe>
        <script type="text/javascript"> 
            editableFrame.document.designMode="on";
        </script> 
    </body> 
</html>

gets the iFrame editable only when run off a server(http://...)(online or from localhost). How do I get this working by simply opening it up as a local html file(file:///...) in the browser?

Some browser specific notes:
1. Firefox needs slightly different code to enable designMode but the problem still remains.
2. IE8 gets me the behavior I want with this code, but it pops up a warning about enabling ActiveX controls which the user must accept before getting the iFrame editable.
3. Opera 10.5 is the only browser that has the behavior I want... iFrames are editable without needing to run the code off a server.

© Stack Overflow or respective owner

Related posts about iframe

Related posts about web-development