Programmatically open a Chrome plugin's options.html page?

前端 未结 4 1367
深忆病人
深忆病人 2020-12-07 21:22

Is there a way to open a Google Chrome plugin\'s options.html page via Javascript in background.html?

4条回答
  •  悲哀的现实
    2020-12-07 22:16

    There is a new method that is enabled beginning with Chrome 42:

    chrome.runtime.openOptionsPage(function callback)

    Open your Extension's options page, if possible.

    The precise behavior may depend on your manifest's options_ui or options_page key, or what Chrome happens to support at the time. For example, the page may be opened in a new tab, within chrome://extensions, within an App, or it may just focus an open options page. It will never cause the caller page to reload.

    If your Extension does not declare an options page, or Chrome failed to create one for some other reason, the callback will set lastError.

提交回复
热议问题