Code not working in Chrome & maybe IE

Richard Korts
Richard Korts used Ask the Experts™
on
I have this code
<?php
// show_summ_ls250.php
session_start();
$fname = "summaries/" . $_SESSION['vid'] . "summary.pdf";
?>
<!DOCTYPE html>

<html>
<head>
<title>Show LS250</title>
<script>
function go_ls250() {
	str = "https://www.lakoshvac.com/<? print $fname; ?>";
	window.open(str);
	window.location = "projectsn.php";	
	self.close();
}
</script>
</head>
<body onLoad="go_ls250()";>

</body>
</html>

Open in new window


For me, this code works as I expect in both Firefox & Chrome. Bit sure about ie, or whatever it's called

In both cases, it opens a new window & shows the pdf file in the window. The user can review, download, etc.

Fir my customer, it works in FireFox if popups are allowed. It does NOT work in chrome; he says it shows the pdf for an instant, then disappears.

I do not want to be dependent of browser settings on client computer.

How can I make this work as desired REGARDLESS of browser?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Richard KortsBusiness Owner / Chief Developer

Author

Commented:
I just tried it in MS Edge, it does NOT show the window with the pdf displayed.

Thanks
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
You can Not reliably make that work.  Any 'automatic' pop-up will normally be blocked by the browsers pop-up blocker.  Only pop-up that are a result of a user action like clicking on a link on the page are allowed.
Richard KortsBusiness Owner / Chief Developer

Author

Commented:
Dave,

So if I put a link the page that goes to that place (like target="_blank"), that will work?

Thanks,

Richard
Fixer of Problems
Most Valuable Expert 2014
Commented:
That should work as long as they have to click on it to use it.  I use a link on this page http://www.dibsplace.com/webdev/index.html to open or download a PDF.
Richard KortsBusiness Owner / Chief Developer

Author

Commented:
Works perfect, thanks Date.

Richard

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial