Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


force firefox or ie to zoom out on page load

Posted on 2009-12-20
Medium Priority
Last Modified: 2013-12-13
I generally create web pages that don't scale well to browsers unless you zoom out a little (i.e. http://www.themarketblock.com ) Rather than redesign the page to a smaller scale, and being lazy, I'm hoping somebody hascode or a link to code (asp/php/java) that would force the visitors browser to zoom out. The code could be any language. TIA
Question by:GlennHarris
  • 2
  • 2
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 600 total points
ID: 26091825
I don't think you're going to be able to do that.  The user's zoom settings are under  their control and no scripting language interacts with it (to the best of my knowledge).

What you can do is detect the viewport and scale sizes based on that, but it's an inexact science at best.
LVL 12

Author Comment

ID: 26091839
OK, thanks for the advice, then maybe you can point me where to look for this code: I'll put a zoom icon for zoom in/out and want that to zoom the screen for them (since most users don't know ctrl+scroll). Thx

Accepted Solution

nergik earned 1400 total points
ID: 26092733
You would need a signed script to access prefs: http://www.mozilla.org/projects/security/components/signed-scripts.html
E.g code like this could do it (this code only works if run on a local page, you get a security pop-up):

javascript:(function getZoomFull(){var FZ='browser.zoom.full';try{netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead');var fz=navigator.preference(FZ);fz=prompt('Full Zoom: ',fz);}catch (e){alert('Permission to access browser.zoom.full was denied');}})();

But i Really Really Really recommend the use of Javascript to change CSS settings when user clicks on your [+] / [-] buttons, you will be able to control the layout and the amount of zoom to be done in the diferent html elements.


Expert Comment

ID: 26125964
hello, how is this going? did you find a solution? can we help with something else?
LVL 12

Author Closing Comment

ID: 31668283

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question