<p dir="auto">I setup a global keyboard shortcut as command+space:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="	globalShortcut.register('CommandOrControl+Space', function(){
		mainWindow.show()
	})"><pre class="notranslate"><code class="notranslate">	globalShortcut.register('CommandOrControl+Space', function(){
		mainWindow.show()
	})
</code></pre></div>
<p dir="auto">This is actually what happens though:</p>
<p dir="auto"><a href="https://www.youtube.com/watch?v=HTN9aIRaLWw" rel="nofollow">https://www.youtube.com/watch?v=HTN9aIRaLWw</a></p>
<p dir="auto">I would expect spotlight search to be disabled.</p>
<h3 dir="auto">Preflight Checklist</h3>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an feature request that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Problem Description</h3>

<p dir="auto">I need a way to give custom responses directly for some http requests from render process.</p>
<p dir="auto">The page url should not be navigate to another url.</p>
<p dir="auto">The virtual code explains what I want to do. (Electron has no this api.)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="webRequest.filterRequest((req, res, passthrough) =&gt; {
    if (req.url == 'https://github.com/') {
        //res.status(200).sendFile('/path/to/hello.htm');
        res.status(200).sendText('HELLO');
    } else {
        passthrough();
    }
})"><pre class="notranslate"><code class="notranslate">webRequest.filterRequest((req, res, passthrough) =&gt; {
    if (req.url == 'https://github.com/') {
        //res.status(200).sendFile('/path/to/hello.htm');
        res.status(200).sendText('HELLO');
    } else {
        passthrough();
    }
})
</code></pre></div>
<p dir="auto">When electron run <code class="notranslate">mainWindow.loadURL('https://github.com/')</code>, user can see <code class="notranslate">HELLO</code> instead of github page. But the page's location is still <code class="notranslate">https://github.com/</code></p>
<h3 dir="auto">Proposed Solution</h3>

<h3 dir="auto">Alternatives Considered</h3>

<h3 dir="auto">Additional Information</h3>

<p dir="auto">Currently, <code class="notranslate">webRequest.onBeforeRequest</code> can redirect a request to another url. but cannot send a response directly without change the url.</p>