/    Sign up×
Community /Pin to ProfileBookmark

Open popup window using java script

Hi All,
I am new to java script. I am opening a pdf file using the java script window.open() function. After open it in new window i print the new window page using java script print function. It works fine for Firefox but in internet explorer it is not showing the print dialog.
I am using this code to open the window.

function openpdf(filename) {
try {
var childwindow = window.open(filename, null);
if (childwindow != null) {
//debugger;
//Checks to see if browser is IE
//if (navigator.appName.indexOf(‘Microsoft’) != -1) {
if (CheckIsIE()) {
try {
childwindow.focus();
//alert(childwindow);
if (!childwindow.closed) {childwindow.print(); }
}
catch (e) {
alert(e);
}
}
else if (navigator.appName.indexOf(‘Netscape’) != -1) {
alert(‘FireFox’);
childwindow.focus();
childwindow.setTimeout(‘print();’, 5000);
}

}
}
catch (e) {
}
}

I am trying self.print(), window.print() and print();

Thnx in advance??

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @rajimr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...