Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Can browser settings be changed via JavaScript?

    Is it possible to change browser settings dynamically using JavaScript? I am needing to changes such things as margins, footer, header when requesting to print the page.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,080
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    In a word, no. Print settings are handled at the application level, and cannot be accessed by means of a script through the browser.
    All you can do is to advise the user (by means of an alert or pop-up) to change his settings to those required for your page. Or of course make your page the right size to print in normal portrait or landscape.

  • #3
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    CSS @media print might be worth looking into for you.
    Most of these have properties there.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Lincoln (UK)
    Posts
    138
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Ditto, CSS is what your after as nikkiH says... using media print you can set html and body margins to whatever you like, feel a bit bad about posting detail in a javascript forum but hey...
    within your print style sheet you just need:
    Code:
    html, body {margin:5px; padding:5px; height:100%;}
    adjust as needed - there are other methods of measurement but I'll let ou look those up.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •