Flex "Permission Denied" when run locally
Posted by
Brad Wood
Sep 25, 2008 08:37:00 UTC
Well, to add to my list of interesting errors encountered with Flex; yesterday I started getting a JavaScript "Permission Denied" when I tried to run my app. The app would run fine but I would get that error every time the page loaded. After commenting out a bunch of stuff, I realized it had started when I added the mx:TabNavigator tag. I finally traced the error down to some JavaScript in the history/historyframe.html file which controls deep linking.I had been running my Flex app directly off my hard drive, so the address in the browser window looked like: file:///X:/dashboard/main.htm
The JavaScript error was thrown when the pages loaded and every time I clicked on a tab. Apparently there is a JS function called processUrl() in historyframe.html that was erroring on this code:
[code]if (!parent._ie_firstload)[/code]IE must be getting confused and thinking that the frame is trying to access its parent document from a different domain. I'd also like to add that I Googled and Googled and couldn't find a single page talking about this or even admiting that I wasn't the first person on Earth to encounter the problem. As annoying as it was, I couldn't find a workaround other than navigating to my Flex app as part of my website: http://www.mysite.com/dashboard/main.html Of course, to get Flex Builder to automatically load that URL when I hit the Run button required me to edit my project properties and supply an "Output Folder URL" in the "Flex Build Path" area. That didn't come without problems either. For some reason, my changes no longer seemed to be appearing. After firing up MS Fiddler I released that my browser was caching the main.swf file now and not even asking the server for it-- even when I held down ctrl-shift while hitting refresh. I was a little puzzled why IE was handling my caching settings differently how that I was on a different Internet Zone. I was able to fix it by going to my IE settings under the General Tab > Browsing History Settings and changing the "Check for newer versions..." from "Automatic" from "Every time I visit the webpage". Now the HTTP request is always sent for the .swf, but a 304 comes back if nothing changed.
Shannon Hicks
I'll address both your problems.
First off, by default Flex Builder tries to run your application using a file:// URL, which now has special security restrictions in most browsers. You'll be better off configuring and running apache on your machine, and switching your "Output Folder URL" to http://localhost/
Second, IE really, really insists on caching SWF files. I'd gone as far as setting my cache size to 0mb, and it still insisted on caching the SWF. The only way around it is to close your browser completely (ALL IE windows), or just use Firefox as your default browser.