如何在webView中为Windows 8商店应用设置cookie [英] how to set cookies in a webView for a windows 8 store app

查看:74
本文介绍了如何在webView中为Windows 8商店应用设置cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过使用该应用的特定用户的代码动态地在我的应用内的webView中设置cookie。我怎样才能做到这一点?请帮助


此外,如果上述情况不可行,我是否可以将Cookie信息作为标题传递?



对于Windows Phone 7,我曾经在WebBrowser.Navigate函数中将cookie信息作为标题传递。但我不知道是否可以在Windows 8中复制WebView。我真的被困在这里:(

解决方案

嘿你尝试用webview控件上的调用脚本用javascript创建cookie:

 

 webView.InvokeScript(" eval"," document。) cookie = \" name = mycookie \" ;;"); 


I want to set cookies in a webView inside my app dynamically via the code for a particular user using the app. How can I achieve this? Please help

Also, If the above is not possible is there a way in which I can pass cookie information as headers?

For Windows Phone 7 I used to pass the cookie info as headers while WebBrowser.Navigate function. But I don't know if that can be replicated for a WebView in Windows 8. I am really stuck here :(

解决方案

hey did you try creating cookies with javascript with invoke script on the webview control:

webView.InvokeScript("eval", "document.cookie = \"name=mycookie\";");


这篇关于如何在webView中为Windows 8商店应用设置cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆