javascript - IE 10 not settingsending cookies (from js) to server - Stack Overflow

A while back I switched a large development project from using cookies to using localStorage.However I

A while back I switched a large development project from using cookies to using localStorage. However I've realized that I was a little bit gun-ho and that some of the cookies were actually need on the server.

I have set these back from localStorage to using cookies. However in the interim I have installed IE10 on my Win7 dev box and also switched my development server from IIS Express to ISS 7.5 running locally.

To allow Fiddler to intercept my local traffic I access the development pages through the URL

http://local_iis/ 

which is identified in the Hosts file as:

local_iis 127.0.0.1

However IE10 fails to set Cookies when accessing pages from this domain with this test page:

<!DOCTYPE html>
<html xmlns="">
<head>
    <title></title>
    <script type="text/javascript">
        document.cookie = "test=value";
        alert(document.cookie); // gives "" in IE 10
    </script>
</head>
<body>

</body>
</html>

However running my test page from either of the below sets the cookie (and alerts the value)

http://localhost/
http://127.0.0.1/    

The cookie gets set and alerted correctly in both FF and Chrome, as I only ever use IE for development and testing I have changed the security settings down to allow everything in both the Privacy tab, and Local Intranet and Trusted Sites zones under the security tab. I've added local_iis to the trusted sites as well.

Still no cookie being set.

Does anyone know why?

A while back I switched a large development project from using cookies to using localStorage. However I've realized that I was a little bit gun-ho and that some of the cookies were actually need on the server.

I have set these back from localStorage to using cookies. However in the interim I have installed IE10 on my Win7 dev box and also switched my development server from IIS Express to ISS 7.5 running locally.

To allow Fiddler to intercept my local traffic I access the development pages through the URL

http://local_iis/ 

which is identified in the Hosts file as:

local_iis 127.0.0.1

However IE10 fails to set Cookies when accessing pages from this domain with this test page:

<!DOCTYPE html>
<html xmlns="http://www.w3/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        document.cookie = "test=value";
        alert(document.cookie); // gives "" in IE 10
    </script>
</head>
<body>

</body>
</html>

However running my test page from either of the below sets the cookie (and alerts the value)

http://localhost/
http://127.0.0.1/    

The cookie gets set and alerted correctly in both FF and Chrome, as I only ever use IE for development and testing I have changed the security settings down to allow everything in both the Privacy tab, and Local Intranet and Trusted Sites zones under the security tab. I've added local_iis to the trusted sites as well.

Still no cookie being set.

Does anyone know why?

Share Improve this question edited Sep 18, 2013 at 16:31 Rob Church 6,9434 gold badges43 silver badges47 bronze badges asked Mar 14, 2013 at 11:35 MorvaelMorvael 3,5673 gold badges40 silver badges55 bronze badges 1
  • Exactly the same for me. I try to reinstall IE10 but without success. Did you resolv your problem ? – jmcollin92 Commented Apr 6, 2013 at 14:19
Add a ment  | 

1 Answer 1

Reset to default 7

According to another topic found here and follow up of mentioned MS blog there this happens because you have underscore in the name of your machine! Wicked, huh?

See this:

Q5: IE won’t set a cookie when the hostname/domain contains an underscore?

A: Correct. Technically, underscore is not a DNS character, and while Windows will let you use an underscore when naming your machine, it warns you that doing so may cause problems. One such problem is that WinINET blocks attempts to set cookies on such domains.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744692691a4588304.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信