Wednesday 6 November 2013

Google Chrome --allow-file-access-from-files flag, a solution or a workaround

--allow-file-access-from-files: This is an application flag so that some functions can run successfuly if initiated from the local filesystem rather than a web server.

The reason Google announces for this behaviour: Security!
http://blog.chromium.org/2008/12/security-in-depth-local-web-pages.html

After hours of searching the topic, I can tell my personal opinion  as this is a workaround for a problem caused by a poor security threat implemented workaround!


My root issue was: Being unable to transform an XML using an XSL within the same filesystem container (Folder in NTFS). I did receive blank page in chrome; however that worked fine in IE.

test.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl" ?>
<testing>
<T1>
<title>Hello...</title>
<Item2>World!</Item2>
</T1>

</testing>

test.xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h2>My Tests</h2>
    <table border="1">
      <tr bgcolor="red">
        <th>Item1</th>
        <th>Item2</th>
      </tr>
      <tr>
        <td><xsl:value-of select="testing/T1/title"/></td>
        <td><xsl:value-of select="testing/T1/Item2"/></td>
      </tr>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>



More details about how to use this flag: http://www.chrome-allow-file-access-from-file.com/

2 comments:

  1. Nice and helpful post to most of developers thanks for sharing with all of us. You can get more detail how to enable allow-file-access-from-file option for windows and linux here http://www.chrome-allow-file-access-from-file.blogspot.in/

    ReplyDelete
    Replies
    1. Thanks Ritivik for your comment, your link to your post, and good luck with your blog!

      Delete