移除不必要的 decodeURIComponent 调用,并添加 encodeURIComponent 以确保特殊字符在 URL 中正确传递。这修复了包含空格或其他特殊 字符的搜索查询无法正确跳转到 Bing 搜索的问题。
@@ -498,7 +498,7 @@
// 等待焦点效果,然后开始输入
setTimeout(() => {
// 步骤 3: 逐字输入查询内容
- typeText(decodeURIComponent(queryValue), () => {
+ typeText(queryValue, () => {
// 等待输入完成
// 步骤 4: 光标移动到搜索按钮
@@ -512,7 +512,8 @@
// 等待点击效果,然后跳转
// 步骤 6: 跳转到bing搜索
- window.location.href = `https://bing.com/search?q=${queryValue}`;
+ // 修复:对查询值进行 URL 编码,确保特殊字符(如 %20)正确传递
+ window.location.href = `https://bing.com/search?q=${encodeURIComponent(queryValue)}`;
}, 200);
});
},