Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I need the source code of client machine printer name using JavaScript,
which I will implement in my .NET coding.
If any one has any solution, please help me.

Thanks in advance,
Rakesh
Posted
Updated 24-Aug-10 8:18am
v4
Comments
Sandeep Mewara 24-Aug-10 12:04pm    
Reason for my vote of 1
Asking for source code without showing any effort

I don't think it is possible. In case you need an IE only solution, you can make use of ActiveX to get it.
 
Share this answer
 
You need a source code and I need to see some effort made by you before asking so!

As it has already been answered, you wont be able to know the Client system details until you use some ActiveX kind of control (but that would be only IE specific).

Any website/page hosted has access on the server machine and not on client system.
Though, based on complete scenario you might have some other option. Like if you want to print stuff on client printer then you can directly use the print feature of browser from javascript to do that for you.
 
Share this answer
 
XML
<script language="javascript" type="text/javascript">

        var filename;
function winPrintDialogBox(filename) {
    var oShell = new ActiveXObject("WScript.Shell");
    sRegVal = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Device';

    var sName = oShell.RegRead(sRegVal)
    if (sName == '') {
        alert('Please, Check the Default Printer');
    }
    document.getElementById("hdnResultValue").value = sName;
    return sName;
}
function HandleError()
{
    alert("\nNothing was printed. \n\nIf you do want to print this page, then\nclick on the printer icon in the toolbar above.")
    return false;
}
    </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900