Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

How can I use javascript to close a pdf tab in IE

$
0
0

Hi,

In IE 11, I have a problem to close tab with non-standard html content, such as pdf, swf.

The scenario is: on my homepage, I use javascript to open a pdf tab (pdf extensions is installed):

var myWin = window.open("https://localhost/test/test.pdf", "_blank")

Then I need to close this tab, I thought it would be easy as before:

myWin.close()

But this does not work, the object myWin is weird, myWin.closed is always true, even though I did not close it.

and myWin.location.href can not be accessed, IE 11 will throw "Permission denied" error. 

I can close the tabs of normal html content. But When I try tabs containing pdf or swf, I have the above problem.

So...How to close those pdf/swf tabs....Any suggestions?

Thanks in advance.


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>