X
點擊此處開啟此網站的行動版。

技術支援討論區

need script to reset the Firefox browser cache size to the desired value

已張貼

I am looking for a script to execute the below tasks for more than 50+ servers for this i need a powershell or vbscript

to reset the Firefox browser cache size to the desired value, which improves the browser performance. The optimal value is configured to 20 MB. This optimization does not clean the cookies and browsing history. Supported Firefox Version: 30

I am looking for a script to execute the below tasks for more than 50+ servers for this i need a powershell or vbscript to reset the Firefox browser cache size to the desired value, which improves the browser performance. The optimal value is configured to 20 MB. This optimization does not clean the cookies and browsing history. Supported Firefox Version: 30

額外的系統細節

應用程式

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

更多資訊

WestEnd 60 個解決方法 5387 個答案

I don't think FF can go beyond what is in the FF Broswer itself. Anything beyond that is from 3rd party software that you will use to do what your asking.

I don't think FF can go beyond what is in the FF Broswer itself. Anything beyond that is from 3rd party software that you will use to do what your asking.
cor-el
  • Top 10 Contributor
  • Moderator
17534 個解決方法 158559 個答案

That would require to modify this pref:

  • browser.cache.disk.capacity

You would have to create a script that can edit prefs.js in the profile folder or possibly use a mozilla.cfg in the Firefox installation folder to set this pref.

See Configuration:

You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.


You can use the mozilla.cfg file in the Firefox program folder to initialize (set/lock) preferences and run privileged JavaScript code.

The mozilla.cfg file needs to be in the main Firefox program folder (Mac).

These functions can be used in mozilla.cfg:

defaultPref();	// set new default value, requires special data: format for localized prefs
pref();	// set pref, allow changes in current session
lockPref();	// lock pref, disallow changes

This requires a local-settings.js file in the "defaults/pref" folder where the channel-prefs.js file is located that specifies to use mozilla.cfg.

//
pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);

The mozilla.cfg and local-settings.js files need to start with a comment line (//).

See also:

That would require to modify this pref: *browser.cache.disk.capacity You would have to create a script that can edit prefs.js in the profile folder or possibly use a mozilla.cfg in the Firefox installation folder to set this pref. See Configuration: *https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment_before_60 You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the <b>about:profiles</b> page. *Help -> Troubleshooting Information -> Profile Directory:<br>Windows: Show Folder; Linux: Open Directory; Mac: Show in Finder *http://kb.mozillazine.org/Profile_folder_-_Firefox ---- You can use the <u>mozilla.cfg</u> file in the Firefox program folder to initialize (set/lock) preferences and run privileged JavaScript code. The mozilla.cfg file needs to be in the main Firefox program folder ([https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment_before_60 Mac]). These functions can be used in mozilla.cfg: defaultPref(); // set new default value, requires special data: format for localized prefs pref(); // set pref, allow changes in current session lockPref(); // lock pref, disallow changes This requires a <u>local-settings.js</u> file in the "defaults/pref" folder where the channel-prefs.js file is located that specifies to use mozilla.cfg. // pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0); The mozilla.cfg and local-settings.js files need to start with a comment line (//). See also: *http://mike.kaply.com/2012/03/16/customizing-firefox-autoconfig-files/

提出問題者

though the information provided is helpful but i am not well versed with Javascript and still i am not able to understand how to fix browser.cache.disk.capacity to certain value.

can you please provide me the right example of this?

though the information provided is helpful but i am not well versed with Javascript and still i am not able to understand how to fix browser.cache.disk.capacity to certain value. can you please provide me the right example of this?

提出問題者

I tired to create two files mozilla.cfg and local-settings.js but getting error while opening firefox this time that unable to read the configuration file

mozilla.cfg : under C:\Program Files (x86)\Mozilla Firefox

// defaultPref("browser.startup.homepage","data:text/plain,browser.startup.homepage=http://google.co.in");

pref("browser.rights.3.shown", true);

lockPref("app.update.enabled", false);


================================

local-settings.js under : C:\Program Files (x86)\Mozilla Firefox\defaults\pref

// pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0);

I tired to create two files mozilla.cfg and local-settings.js but getting error while opening firefox this time that unable to read the configuration file mozilla.cfg : under C:\Program Files (x86)\Mozilla Firefox // defaultPref("browser.startup.homepage","data:text/plain,browser.startup.homepage=http://google.co.in"); pref("browser.rights.3.shown", true); lockPref("app.update.enabled", false); ============================================ local-settings.js under : C:\Program Files (x86)\Mozilla Firefox\defaults\pref // pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0);

提出問題者

i used the below script and it is working fine as expected

@echo off

FOR /F "tokens=*" %%R IN ('dir /B /AD "%APPDATA%\Mozilla\Firefox\Profiles\*.default"') DO CALL:write_settings %%R GOTO:EOF

write_settings

DIR "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" /AA /B if ERRORLEVEL 1 GOTO:EOF

echo user_pref("browser.download.useDownloadDir", false); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" echo user_pref("browser.tabs.autoHide", false); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" echo user_pref("browser.cache.disk.capacity", 30000); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" echo user_pref("dom.disable_open_during_load", false); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js"


ATTRIB -A "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" GOTO:EOF

i used the below script and it is working fine as expected @echo off FOR /F "tokens=*" %%R IN ('dir /B /AD "%APPDATA%\Mozilla\Firefox\Profiles\*.default"') DO CALL:write_settings %%R GOTO:EOF :write_settings DIR "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" /AA /B if ERRORLEVEL 1 GOTO:EOF echo user_pref("browser.download.useDownloadDir", false); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" echo user_pref("browser.tabs.autoHide", false); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" echo user_pref("browser.cache.disk.capacity", 30000); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" echo user_pref("dom.disable_open_during_load", false); >> "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" ATTRIB -A "%APPDATA%\Mozilla\Firefox\Profiles\%1\prefs.js" GOTO:EOF