|
This might sound like a wierd question, but is there a way to automatically have a popup window close as soon as it opens?
I have a popup that triggers a PHP download, and opens it into MS Excel, then I'd like the window that launched the download to automatically close.
I've tried everything I can think of:
<body onload="self.close()">
<body onblur="self.close()">
<body onload="document.close()">
I'm out of ideas...
Just incase this matters, here's the complete page code:
<?php
require_once ('include/mysql_connect.php');
$select = "SELECT * FROM vehicles where status = 'Active' or status = 'Pending'";
$export = mysql_query($select);
$fields = mysql_num_fields($export);
for ($i = 0; $i < $fields; $i++) {
$header .= mysql_field_name($export, $i) . "\t";
}
while($row = mysql_fetch_row($export)) {
$line = '';
foreach($row as $value) {
if ((!isset($value)) OR ($value == "")) {
$value = "\t";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data .= trim($line)."\n";
}
$data = str_replace("\r","",$data);
if ($data == "") {
$data = "\n(0) Records Found!\n";
}
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=Inventory.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
?>
<html>
<head>
</head>
<body onload="self.close()">
</body>
</html>
|