Code not working in Chrome & maybe IE

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?
Richard KortsAsked:
Who is Participating?
 
Dave BaldwinFixer of ProblemsCommented:
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.
0
 
Richard KortsAuthor Commented:
I just tried it in MS Edge, it does NOT show the window with the pdf displayed.

Thanks
0
 
Dave BaldwinFixer of ProblemsCommented:
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.
0
 
Richard KortsAuthor Commented:
Dave,

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

Thanks,

Richard
0
 
Richard KortsAuthor Commented:
Works perfect, thanks Date.

Richard
1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.