Javascript/Detect Browser Page Setup
Expert: Randy L. Taylor - 11/5/2005
QuestionDear Randy I've a feeling that what I'm asking is almost impossible to achieve.
In One of my applications I'm offering a printer friendly page. The problem is the default page setup of browsers, which decide the margins and paper orientation.
Is it possible to detect the default settings of the client browser with javascript, at least the left margin setting, so that I can dynamically change the margins of my page? All my clients will be using IE above 5.0
Regards
Thomas C
AnswerHi there Thomas,
I have good news and bad news. First of all, the good news: what you want to do IS possible! (at least I think, more on this below) Now, the bad news: I have absolutely no experience in doing this, and can only show you the documentation and let you try and figure it out yourself. :(
You have to use print templates, and I've given you some links below on the basics. Like I said, I've never tried this before, but I think with all the example code you can probably figure it out. A warning: I am a little confused, because MSDN indicates it requries C++ (at least in some places it does), while at webreference it doesn't mention C++ at all and all the examples are just DHTML.
http://www.webreference.com/js/column89/
http://www.webreference.com/js/tips/010809.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html/bey...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie55/html/pri...
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/prin...
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/prin...
take care and good luck,
Randy L. Taylor