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

  • Home
  • SEARCH
  • 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 8515471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:09:21+00:00 2026-06-11T05:09:21+00:00

$(#print).on(‘click’, function () { var child = window.open(image.jpg, _blank, location=0,toolbar=0,scrollbars=1,fullscreen=1,menubar=0); //any way to know/wait

  • 0
    $("#print").on('click', function () {
        var child = window.open("image.jpg", "_blank", "location=0,toolbar=0,scrollbars=1,fullscreen=1,menubar=0");
        //any way to know/wait for image to load?
        child.print();
    });

Any way for my parent window to know that the child window has completed loading the image prior to calling .print()? If they were trigger happy they would end up printing a blank page.

I’ve tried both:

child.attachEvent("onload", function () { child.print(); });

and

child.attachEvent("DOMContentLoaded", function () { child.print(); });
//(found this online, apparently it's Firefox only, still didn't work)
  • 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-06-11T05:09:22+00:00Added an answer on June 11, 2026 at 5:09 am

    You are going to need to create a page, i.e. print.html and add this script to it:

    <html>
    <head>
    </head>
    <body>
    <script>
    (function( w, d ) {
        var paramsHash = {},
            img = new Image(); 
    
        (function() {
            var qs = w.location.href.split( '?' )[ 1 ],
                items = [],
                l = 0,
                i = 0,
                param;
            if( qs && qs.indexOf( '&' ) ) {
                items = qs.split( '&' );
            } else {
                items = [ qs ];
            }
            l = items.length;
            for( ; i < l; i++ ) {
                param = items[i].split( '=' );
                paramsHash[ param[ 0 ] ] = param[ 1 ];
            }
        })();
        console.log(paramsHash);
        img.src = paramsHash.img;
        //after the image is loaded, call this function
        img.onload = function() {
            window.print();        
        };
        d.body.appendChild( img );
    
    })( window, document );
    </script>
    </body>
    </html>
    

    Then use it like so:

    $("#print").on('click', function () {
        window.open("print.html?img=image.jpg", "_blank", "location=0,toolbar=0,scrollbars=1,fullscreen=1,menubar=0");
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

var print = function(text){ document.write(text); document.write(</br>); } var A = function(){ } A.prototype.name=A; var
print() doesn't work in IE after opening a new window. It works in Chrome.
print hellp world :) i want to ask you if exist a function or
Print screen: http://imageshack.us/photo/my-images/253/bluebackground.png/ I have a treeViewItem and when I click on it, this
A print button on a site I am working on opens a new window
Print all combinations of a number N, as a sum of positive integers? They
Print_r function is usually to output the array result, but I want to hide
print 'restore db1' run_command('pg_restore -i -h localhost -p 5432 -U postgres -d db1 -v
print <ul>; foreach ($arr as $value) { echo(<li> . $value[storeid] . . ($value[dvdstock] +
print "@_\n"; 4109 4121 6823 12967 12971 14003 20186 How do I sort it

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.