Does Chrome provide an API to get/set a page's zoom level?

2,895 views
Skip to first unread message

Ziyuan Yao

unread,
May 4, 2012, 6:40:16 PM5/4/12
to Chromium-extensions
I know I can use document.body.style.zoom="150%" to set it, but this
approach has a problem with Facebook (try it yourself; when you scroll
down your Facebook timeline, the right-side Chat pane will jump to the
middle of the screen...).

So I wonder if an extension can directly get/set the browser's zoom
level for a tab (exactly the same setting on the Wrench menu).

Ziyuan Yao

unread,
May 5, 2012, 1:28:58 AM5/5/12
to Chromium-extensions
document.body.style.zoom="150%" works poorly with Facebook, Gmail and
Google Reader, enough for me to abandon this approach.

I also tried to simulate a Ctrl+<+> keyboard event to trigger Chrome's
own page zoom-in, to no avail so far, because there seems to be a bug
in WebKit/Chrome that prevents you from making such an event.

PhistucK

unread,
May 5, 2012, 3:11:11 AM5/5/12
to Ziyuan Yao, Chromium-extensions
Star crbug.com/30583 for updates (or help by contribuiting an implementation yourself, in C++. I think no one is working on this anymore).

PhistucK



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Ziyuan Yao

unread,
May 5, 2012, 3:47:30 AM5/5/12
to Chromium-extensions
That bug asks for a per-tab zoom API, not an API that directly
controls Chrome's current, per-domain zoom features. So I filed my own
bug: https://code.google.com/p/chromium/issues/detail?id=126353

Currently I have two solutions to work around the problem:

1. Educate users to use manual zooming:
https://sites.google.com/site/phoneticallyintuitiveenglish/become-a-pie-user-now/download-pie-transformer

2. Try resizing text only, via a css style like "text-size: 150%".

On May 5, 3:11 pm, PhistucK <phist...@gmail.com> wrote:
> Star crbug.com/30583 for updates (or help by contribuiting an
> implementation yourself, in C++. I think no one is working on this anymore).
>
> ☆*PhistucK*
>
>
>
>
>
>
>
> On Sat, May 5, 2012 at 8:28 AM, Ziyuan Yao <yaoziy...@gmail.com> wrote:
> > document.body.style.zoom="150%" works poorly with Facebook, Gmail and
> > Google Reader, enough for me to abandon this approach.
>
> > I also tried to simulate a Ctrl+<+> keyboard event to trigger Chrome's
> > own page zoom-in, to no avail so far, because there seems to be a bug
> > in WebKit/Chrome that prevents you from making such an event.
>
> > On May 5, 6:40 am, Ziyuan Yao <yaoziy...@gmail.com> wrote:
> > > I know I can use document.body.style.zoom="150%" to set it, but this
> > > approach has a problem with Facebook (try it yourself; when you scroll
> > > down your Facebook timeline, the right-side Chat pane will jump to the
> > > middle of the screen...).
>
> > > So I wonder if an extension can directly get/set the browser's zoom
> > > level for a tab (exactly the same setting on the Wrench menu).
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-extensions" group.
> > To post to this group, send email to chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org.
Reply all
Reply to author
Forward
0 new messages