PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, August 21, 2022

[FIXED] how to access browser %variables% (enclosed in percent % signs)

 August 21, 2022     browser, console.log, environment-variables, firefox, urlencode     No comments   

Issue

In various browsers you can find these type of variables %VAR%

In firefox about:config you can find:

%LOCALE%
%VERSION%
%OS%
%GOOGLE_LOCATION_SERVICE_API_KEY%

etc..

Where are those variables stored or set, and how to console log their value?


Solution

in firefox source code file named URLFormatter.jsm, you can see how those variables are declared.

For example, %OS% return a value from Services.appinfo.OS

%LOCALE% returns Services.locale.appLocaleAsBCP47

%CHANNEL% returns UpdateUtils.UpdateChannel

%GOOGLE_LOCATION_SERVICE_API_KEY% returns AppConstants.MOZ_GOOGLE_LOCATION_SERVICE_API_KEY

Those functions are defined within the prototype nsURLFormatterService but to access AppConstants for example, you need to use a custom firefox build,; like Firefox Nightly or enable experimental mode.

Those variables can be imported within a custom addon, and importing them using ChromeUtils.

const { AppConstants } = ChromeUtils.import(
  "resource://gre/modules/AppConstants.jsm"
);

Here is the more advanced documentation



Answered By - assayag.org
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing