Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

tabs.reload()

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!

Reload a tab, optionally bypassing the local web cache.

Syntax

chrome.tabs.reload(
  tabId,            // optional integer
  reloadProperties, // optional object
  function() {...}  // optional function
)

This API is also available as browser.tabs.reload() in a version that returns a promise.

Parameters

tabIdOptional
integer. The ID of the tab to reload. Defaults to the selected tab of the current window.
reloadPropertiesOptional
object.
bypassCacheOptional
boolean. Bypass the local web cache. Default is false.
callbackOptional
function. Called when the page has been reloaded. This function is passed no arguments. If the tab can't be found, chrome.runtime.lastError is set and should be checked in this function.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No 45.0 No 33

Examples

Reload the active tab of the current window:

chrome.tabs.reload();

Reload the active tab of the current window, bypassing the cache:

chrome.tabs.reload({bypassCache: true});

Reload the tab whose ID is 1, bypassing the cache and calling a callback when done:

function onReloaded() {
  if (chrome.runtime.lastError) {
    console.log("failed");
  } else {
    console.log("finished");
  }
}

chrome.tabs.reload(1, {bypassCache: true}, onReloaded);

Example add-ons

Acknowledgements

This API is based on Chromium's chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

文档标签和贡献者

 此页面的贡献者: Makyen, wbamberg
 最后编辑者: Makyen,