首页 > 解决方案 > 使用表单时删除缓存的搜索

问题描述

我正在使用这段代码:

<form action="https://google.com/search" method="get">
<input type="text" name="q" />

允许我从自定义主页使用 google 进行搜索。但是在每次搜索之后,它似乎都在缓存我的搜索词。

当我单击表单返回 HTML 页面时,它会将我以前的搜索作为自动填充下拉框。

我想禁用此功能并停止页面缓存。

谢谢你

标签: javascripthtmlcss

解决方案


它应该像在表单元素中添加 autocomplete="off" 一样简单。

<form action="https://google.com/search" method="get" autocomplete="off"></form>

推荐阅读