Jump to content

Set zoom browser via code


claudio.piffer

Recommended Posts

Hi,

I would like to manage the browser zoom with the uniTrakBar component. When the app starts I would like it to be set to 100% and once logged in allow the user to zoom up to 150% using the option in the app interface

I tried to play with the DesktopViewport.InitialScale property by setting various values but nothing happens. 

Where am I doing wrong?

Is it possible, via code, to limit the browser zoom to a minimum and maximum value?

The application is desktop (not mobile) and I am running the tests in Chrome and Firefox

Thank you very much

Link to comment
Share on other sites

8 hours ago, claudio.piffer said:

I would like to manage the browser zoom with the uniTrakBar component. When the app starts I would like it to be set to 100% and once logged in allow the user to zoom up to 150% using the option in the app interface

I tried to play with the DesktopViewport.InitialScale property by setting various values but nothing happens. 

Where am I doing wrong?

Is it possible, via code, to limit the browser zoom to a minimum and maximum value?

The application is desktop (not mobile) and I am running the tests in Chrome and Firefox

Hello,

"I would say not possible in most browsers, at least not without some additional plugins. And in any case I would try to avoid relying on the browser's zoom as the implementations vary (some browsers only zoom the fonts, others zoom the images, too etc). Unless you don't care much about user experience."

https://stackoverflow.com/questions/1055336/changing-the-browser-zoom-level

Draft:

var currFFZoom = 1;
var currIEZoom = 100;
if (Ext.browser.name == 'Firefox') {
    var step = 0.02;
    currFFZoom += step;
    $('body').css('MozTransform', 'scale(' + currFFZoom + ')');
} else {
    var step = 2;
    currIEZoom += step;
    $('body').css('zoom', ' ' + currIEZoom + '%');
}

...

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
On 6/14/2021 at 1:40 AM, Sherzod said:

Hello,

"I would say not possible in most browsers, at least not without some additional plugins. And in any case I would try to avoid relying on the browser's zoom as the implementations vary (some browsers only zoom the fonts, others zoom the images, too etc). Unless you don't care much about user experience."

https://stackoverflow.com/questions/1055336/changing-the-browser-zoom-level

Draft:

var currFFZoom = 1;
var currIEZoom = 100;
if (Ext.browser.name == 'Firefox') {
    var step = 0.02;
    currFFZoom += step;
    $('body').css('MozTransform', 'scale(' + currFFZoom + ')');
} else {
    var step = 2;
    currIEZoom += step;
    $('body').css('zoom', ' ' + currIEZoom + '%');
}

...

According to this setting, you can't pull in full screen

As shown in the figure:

不会自动拉申.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...