DocWatson
10-28-2009, 12:32 AM
Hey guys
Here's the flow for my application:
1) Flash sends a request via RPC to my server
2) Server gets the request, writes a file to a pre-defined directory, sends Flash back the address of where the PHP file to get it is located
3) Flash uses a navigateToUrl call as so:
var req:UrlRequest = new UrlRequest("http://urlgoeshere.com/scripts/download.php?id=somenumber");
navigateToUrl(req, "_blank");
4) The PHP file itself has been tested and works fine for sending the user's browser the file.
Here's where my problem comes in:
At the end of everything the PHP file echoes a string of Javascript
$jscript = "<script type='text/javascript'>";
$jscript = $jscript . "window.open('','_self','');";
$jscript = $jscript . "window.close();";
$jscript = $jscript . "</script>";
echo $jscript;
That echo works perfectly fine with IE and Firefox on Windows. However, it DOESN'T work with Safari on a Mac. Instead, Safari pops up a new, blank window (good, it means navigateToUrl works just fine), downloads the file in the background (also fine), but then leaves the blank window up. I've tried multiple methods of closing the window, but nothing works with Safari.
I've even added echoes of just text (e.g. 'echo "Hi!";) but they don't show up. This leads me to believe that maybe Safari has some security rules in place regarding pop-up windows from Flash, but I haven't seen anything on it. Anyone have ideas? Suggestions?
Here's the flow for my application:
1) Flash sends a request via RPC to my server
2) Server gets the request, writes a file to a pre-defined directory, sends Flash back the address of where the PHP file to get it is located
3) Flash uses a navigateToUrl call as so:
var req:UrlRequest = new UrlRequest("http://urlgoeshere.com/scripts/download.php?id=somenumber");
navigateToUrl(req, "_blank");
4) The PHP file itself has been tested and works fine for sending the user's browser the file.
Here's where my problem comes in:
At the end of everything the PHP file echoes a string of Javascript
$jscript = "<script type='text/javascript'>";
$jscript = $jscript . "window.open('','_self','');";
$jscript = $jscript . "window.close();";
$jscript = $jscript . "</script>";
echo $jscript;
That echo works perfectly fine with IE and Firefox on Windows. However, it DOESN'T work with Safari on a Mac. Instead, Safari pops up a new, blank window (good, it means navigateToUrl works just fine), downloads the file in the background (also fine), but then leaves the blank window up. I've tried multiple methods of closing the window, but nothing works with Safari.
I've even added echoes of just text (e.g. 'echo "Hi!";) but they don't show up. This leads me to believe that maybe Safari has some security rules in place regarding pop-up windows from Flash, but I haven't seen anything on it. Anyone have ideas? Suggestions?