「飲食店検索」の版間の差分
提供: 川西図鑑
その他の操作
編集の要約なし |
編集の要約なし |
||
| 8行目: | 8行目: | ||
</form> | </form> | ||
<script> | <script> | ||
const urlParams = new URLSearchParams(window.location.search); | document.addEventListener('DOMContentLoaded', () => { | ||
const searchVal = urlParams.get('検索'); | const urlParams = new URLSearchParams(window.location.search); | ||
const searchVal = urlParams.get('検索'); | |||
const | const input = document.querySelector('input[name="検索"]'); | ||
// | if (searchVal) { | ||
const decoded = decodeURIComponent(searchVal); | |||
input.value = decoded; | |||
} | |||
// 無限ループ防止: URLとデコード済みが一致しなければ書き換え | |||
if (searchVal !== decoded) { | |||
const newUrl = window.location.pathname + '?検索=' + encodeURIComponent(decoded); | |||
window.history.replaceState({}, '', newUrl); // ページ遷移はさせない | |||
} | |||
} | |||
}); | |||
</script> | </script> | ||
</html> | </html> | ||
2025年10月27日 (月) 11:34時点における版
店舗検索
エラー: テーブル店舗情報が見つかりません。