/    Sign up×
Community /Pin to ProfileBookmark

Detecting Browser Text Size Changes?

Hello –

Does anybody know how to dynamically detect changes in
browser text size settings from within Javascript?
For example, if the user were to switch browser text
size from large to small while viewing a web page?

( If IE, top menu View->Text Size) I’m only interested
in WHEN a change occurs; I don’t need to know which
text size setting the user has chosen.

I haven’t found any standard DOM event handlers for this
purpose, although I’ve noticed that the window
onresize handler is triggered – but I don’t know to
distinguish text size changes from resize events
caused by the user changing the browser window
size/dimensions – is there possibly detail info
associated with the resize event object which could
indicate a browser text size change? I’m trying to
find a general DOM standardized way to solve this
problem, but would be grateful for any suggestions,
even if browser specific in nature. Thanks for any
help you can offer!!

  • Holten
  • to post a comment
    JavaScript

    3 Comments(s)

    Copy linkTweet thisAlerts:
    @khalidali63Feb 03.2003 — It does not seem to be possible( I could be wrong).

    What he is trying to do is get the default browser settings.

    and unless you give some properties to a div you can not retrieve them.

    What I mean is if I have a div e.g

    <div id="temp"></div>

    its position is relative by default.

    now if I wanted to access its properties say

    document.getElementById("temp").style.fontSize;

    It will not return anything unless in the div declaration i define a font-size property.

    <div id="temp" style="font-size:16pt;"></div>

    Now if try to get fonstSize I'll get it.

    It will be interesting if some one can make it work or may be I am not taking a proper approach to it..

    cheers

    Khalid
    Copy linkTweet thisAlerts:
    @hnorrisauthorFeb 03.2003 — Dave Clarke's excellent suggestion (thanks!) was one idea I had already considering trying, but agreed, it is a real hack. I just want to clarify though, I'm NOT trying to determine the exact browser text size setting - I just want to detect WHEN the user changes the browser text size. Given how much the browser text size impacts the display of web pages, it seems odd there isn't a simple, straight forward way to determine such info...

  • - Holten
  • Copy linkTweet thisAlerts:
    @hnorrisauthorFeb 04.2003 — This is a simple, lightweight method to detect browser text size changes, but is an IE 5+ specific solution. Insert this code in your page and Substitute alert with your own function:

    <div

    style="whatever:expression(this.h&&this.h!=this.offsetHeight?alert(this.

    offsetHeight):false,this.h=this.offsetHeight);position:absolute">&nbsp;</div>

  • - Holten
  • ×

    Success!

    Help @hnorris spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.23,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...