I am trying to print a page using javascript, and i am getting a “Bad Request” when a new window popsup if i clicked the ‘print’ button.
Here is my javascript code that opens a window by capturing the current location and assigning the media css to print.
function printerFriendlyNew() {
genPopUp = window.open("","printer","toolbar=no,location=no,scrollbars=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=760,height=600");
genPopUp.location.href = document.location.href + "&css=print";
if (genPopUp.opener == null) genPopUp.opener = window;
genPopUp.opener.name = "opener";
}
Any idea why i get the ‘bad request’ error ?
Got this resolved… crazy me, am just blindly appending “&css=print” since I have URLs which have querystring, and it works fine for those, and bugs out for those which don’t. I added this to my existing javascript and this resolved the issue.