Bladeren bron

【修复】搜索查询参数编码问题

移除不必要的 decodeURIComponent 调用,并添加 encodeURIComponent
以确保特殊字符在 URL 中正确传递。这修复了包含空格或其他特殊
字符的搜索查询无法正确跳转到 Bing 搜索的问题。
PJ568 1 jaar geleden
bovenliggende
commit
dc250f04f2
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3 2
      index.html

+ 3 - 2
index.html

@@ -498,7 +498,7 @@
                 // 等待焦点效果,然后开始输入
                 setTimeout(() => {
                   // 步骤 3: 逐字输入查询内容
-                  typeText(decodeURIComponent(queryValue), () => {
+                  typeText(queryValue, () => {
                     // 等待输入完成
                     setTimeout(() => {
                       // 步骤 4: 光标移动到搜索按钮
@@ -512,7 +512,8 @@
                             // 等待点击效果,然后跳转
                             setTimeout(() => {
                               // 步骤 6: 跳转到bing搜索
-                              window.location.href = `https://bing.com/search?q=${queryValue}`;
+                              // 修复:对查询值进行 URL 编码,确保特殊字符(如 %20)正确传递
+                              window.location.href = `https://bing.com/search?q=${encodeURIComponent(queryValue)}`;
                             }, 200);
                           });
                         },