: , , , , , , ( ) .
. URL- window.open, , script, window.print, . , , , , "barcode.php" GET, , , .
// Assumes parameters provided are safe to use in a url.
window.open('barcode.php?name=' + name + '&text=' + text + '&number=' + number');
, "barcode.php", script:
document.onload = function() {
window.focus();
window.print();
window.close();
};
, , , , ( , ) load onload.
: , . , , .
, :
window.openwrite ( writeln) , .write a <script>, :- ,
document.readyState; , . : setTimeout, document.readyState, . ( , .)- ,
load onload, , .
, :
var WindowObject = window.open();
WindowObject.document.write('<img src="http://i.imgur.com/Jvh1OQm.jpg" />');
WindowObject.document.write('<script>(' + (function() {
function checkReadyState() {
if (document.readyState === 'complete') {
window.focus();
window.print();
window.close();
} else {
setTimeout(checkReadyState, 200);
}
}
checkReadyState();
}) + ')();</sc' + 'ript>');
, , , . , , -.