我以下列方式打开了一个新标签:
<form id="commentForm" target="_blank" action="{{ url_for('form_process', user=user, id=id) }}" method="POST">
这是我在 python 中的表单处理函数:
def form_process(user, id):
#some code
session['post_comment'] = 'true'
return "<script>window.onload = window.close();</script>"
When the tab closes I want the session to be updated in my previous page that contained the form.我在 if 中使用会话变量,如下所示:
{% if 'post_comment' in session and session['post_comment'] == 'true' %}
我认为唯一的方法是刷新页面。选项卡关闭时如何刷新页面?谢谢