diff --git a/static/script.js b/static/script.js index 85a9d55..bde5b95 100644 --- a/static/script.js +++ b/static/script.js @@ -568,27 +568,14 @@ function hideError() { errorMessage.style.display = 'none'; } -// 通过POST请求跳转到历史页面 -async function goToHistory() { - try { - const response = await fetch('/history', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - } - }); - - if (response.ok) { - // 如果返回的是HTML页面,直接重定向 - window.location.href = '/history'; - } else { - throw new Error('跳转失败'); - } - } catch (error) { - console.error('跳转到历史页面失败:', error); - // 如果POST失败,尝试直接GET跳转 - window.location.href = '/history'; - } +// 跳转到历史页面 +function goToHistory() { + // 创建表单进行POST请求跳转,更安全 + const form = document.createElement('form'); + form.method = 'POST'; + form.action = '/history'; + document.body.appendChild(form); + form.submit(); } // 添加显示函数 diff --git a/templates/index.html b/templates/index.html index d091ddf..da896f2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -117,7 +117,7 @@
PythonOCC 可用: {{ pythonocc_available }} | 服务版本: 3.0.0