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.
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.
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.
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.
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).
Try this:
<script type="text/javascript"> function zoom() { document.body.style.zoom = "300%" } </script> <body onload="zoom()"> <h6>content</h6> </body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With