كيفية إعادة تشغيل Firefox من التعليمات البرمجية؟

StackOverflow https://stackoverflow.com/questions/5017895

  •  14-11-2019
  •  | 
  •  

سؤال

كيفية بشكل صحيح إعادة تشغيل Firefox (دون أي "استعادة جلسة" الأشياء ومع نفس النوافذ كما كان من قبل) من التعليمات البرمجية؟

أعرف PID من "Firefox-Bin" في عملية نصية باش ولدي البرنامج المساعد المخصص الذي تم تحميله فيه.

هل كانت مفيدة؟

المحلول

Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
const nsIAppStartup = Components.interfaces.nsIAppStartup;
Components.classes["@mozilla.org/toolkit/app-startup;1"]
          .getService(nsIAppStartup)
          .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);

Note that this applies to Firefox 4 so the code might be slightly different for earlier versions.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top