使用JavaScript重新启动Google

使用JavaScript重新启动Google

本文介绍了使用JavaScript重新启动Google Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在chrome中,如果我转到 chrome://flags/并在标志"页面上进行更改(启用/禁用功能),则会在页面底部显示一个按钮,单击该按钮时重新启动chrome并重新打开已打开的页面.有谁知道哪种javascript代码允许这种情况发生?

In chrome, if I go to chrome://flags/ and make a change on the flags page ( enable/disabe features ), a button appears at the bottom of the page which when clicked restarts chrome and re-opens the pages that were opened.Does anyone know what javascript code allows that to happen ?

这是按钮出现的html

This is the html where the button appears

<div class="needs-restart" jsdisplay="needsRestart">
        <div i18n-content="flagsRestartNotice">NEEDS_RESTART</div>
        <button class="experiment-restart-button"
                type="button"
                i18n-content="flagsRestartButton">RESTART</button>
</div>

谢谢

推荐答案

单击该按钮即可调用restartBrowser()函数.

A restartBrowser() function is called from the click of that button.

从flags.js:

/**
 * Asks the C++ FlagsDOMHandler to restart the browser (restoring tabs).
 */
function restartBrowser() {
  chrome.send('restartBrowser');
}

就像评论所暗示的那样,它会挂接到Chrome背后的C ++代码中,这将尝试重新启动.

Like the comment implies, it hooks into the C++ code behind Chrome, which will attempt a restart.

这篇关于使用JavaScript重新启动Google Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 06:17