Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Increase browser zoom level on page load?

How to increase browser zoom level on page load?

here is my web link recently i got the task to increase its width just like if Firefox we press Ctrl + and browser zoom level is increases is there any way to do this automatically in all browsers on page load.

like image 889
Danish Iqbal Avatar asked Feb 25 '12 05:02

Danish Iqbal


People also ask

How do I change my browser zoom level to 80?

Click the three vertical dots in the top-right corner of Chrome and then select “Settings.” Click “Advanced” and then select the “Privacy and Security” option. Scroll down and click “Site Settings.” Now, locate the “Zoom Levels” option. In this menu, you can view the custom zoom levels you've set for any given website.

How do I change the default zoom level in Chrome?

To set a new default zoom level, click on the Menu button in the top-right of the Chrome browser, then click Settings. Type 'Page Zoom' in the search box or click on Appearance on the left-hand side. Click on the drop-down menu for Page zoom and select a new default zoom level.

How do I check my browser zoom level?

One way to detect the browser zoom level is to use the window. devicePixelRatio property. When we zoom in or out, the resize event will be triggered.


2 Answers

Personally I think this is a bad idea; either design your site so it scales easily (not hard with proper CSS/HTML techniques). Typically you should not make UX decisions for people.

But it is possible.

Demo: http://jsfiddle.net/q6kebgbh/4/

.zoom {     zoom: 2;     -moz-transform: scale(2);     -moz-transform-origin: 0 0; } 

Note that previous versions of this answer used transform to support more browsers. However, this shortened code appears to work for current versions of Chrome, FF, Safari and IE (as well as previous versions of IE, which have supported zoom for a long time).

like image 166
Tim M. Avatar answered Sep 26 '22 23:09

Tim M.


Try this:

<script type="text/javascript">         function zoom() {             document.body.style.zoom = "300%"          } </script>  <body onload="zoom()"> <h6>content</h6> </body> 
like image 21
Vinod Avatar answered Sep 26 '22 23:09

Vinod