Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7412887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:36:38+00:00 2026-05-29T06:36:38+00:00

I create a secondary browser window with Javascript code, using the window.open function, and

  • 0

I create a secondary browser window with Javascript code, using the window.open function, and fill it programmatically with some HTML content. It works well for all browsers that my application supports except for one: Safari on Mac. In fact, the window itself is OK but the print command is disabled. Does anybody have an idea why? I should mention that the main reason to show this window is to allow the users to print some data. I guess I could implement a “Print” button in the page but I would prefer not to (and it may not work either, but I haven’t tried it).

Here is a simplified example of the code that I use to create the HTML content:

        var pp = window.open("", "_blank");
        pp.document.writeln("<html>");
        pp.document.writeln("<head>");
        pp.document.writeln("<title>");
        pp.document.writeln("Hello");
        pp.document.writeln("</title>");
        pp.document.writeln("</head>");
        pp.document.writeln("<body>");
        pp.document.writeln("The body");
        pp.document.writeln("</html>");
        pp.document.close();

I tried variations around that code, without any success. My tests are done with Safari 5.1 on Mac OS X 10.6.8. Any help is welcome!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:36:39+00:00Added an answer on May 29, 2026 at 6:36 am

    Have the window print itself:

    Before your </html> add:

    pp.document.writeln("<script type='text/javascript'>window.print()</script>");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background Create a series of SQL JOIN statements using two operands: primary and secondary.
I am passing an object to a secondary thread using the following code: (void)login:(id)sender
I'm trying to create a chart using highcharts to represent some data. However i'm
Create a file called Valid[File].txt and stick some text in it. Start powershell and
I'd like to create a web application using Spring and .jspx web pages. My
In my current program I have a main window and a secondary window that
I have a NSArray containing objects. I want to create a secondary NSArray containing
I often have to open a secondary editor outside of Netbeans in order to
I have such table: CREATE VIRTUAL TABLE t USING FTS3(hidden, text1, text2) I would
I've decided to get used to using Javascript as my server sided (I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.