Safari中的Flask cookies.get

时间:2017-04-25 08:52:29

标签: javascript python cookies flask safari

我通过JS在HTML中设置cookie,之后进入Flask app并打印

JS Part:

<html>
<head>
    <script>
        document.cookie = "screen_color="+screen.colorDepth;
        document.cookie = "screen_height="+screen.height;
        document.cookie = "screen_width="+screen.width;
    </script>

</head>
<body>
<p>Hello world</p>
</body>
</html>

烧瓶部分:

@app.route('/test', methods=['GET', 'POST'])
def test():
    screen_color = request.cookies.get('screen_color')
    screen_height = request.cookies.get('screen_height')
    screen_width = request.cookies.get('screen_width')
    print(screen_color, screen_width, screen_height)
    return 'ok'

在Chrome中一切正常:我加载页面和python打印cookie值,但在Safari中,Python打印无。

我做错了什么?

0 个答案:

没有答案