IE and session loss (new window cookie loss) measurement and solution _php skills

Source: Internet
Author: User
Today in a group of people asked to IE6 in the use of JS Open, found in a new window and get no session,
After using the following test code test found that because Phpsessionid storage is a process-level validity period, only the same process can be obtained, many people say, open or target= "_blank" will open the new IE process,
Therefore, the phpsessionid of the previous window does not follow the new window to go, resulting in the acquisition.
My own tests used IETEST,6/7/8 (9 does not start up, not sure), all appear the same situation.
However, this condition is not present in the IE10 test that is used with Windows.
Chrome is also multiple threads, but this is not the case.

Firefox does not exist in this situation.
index.php
Copy Code code as follows:

<?php
Setcookie (' kkkkk ', ' bbbb ', Time () + 1111111);
Session_Start ();
$_session[' qidizi '] = ' kkkk ';
Var_dump ($_session,$_cookie);
?>
<input type= "button" value= "D" onclick= "window.open ('./b.php ');"/>
<a href= "b.php" target= "_blank" >dddd</a>

b.php Jump Page
Copy Code code as follows:

<?php
Session_Start ();
Var_dump ($_session,$_cookie);

As you can see from the test, if the cookie setting is deferred, rather than process-level, it will be visible after the open
Therefore, in view of this situation, to prevent users from using the IE kernel login status is lost, can be used with cookies to use,
The PHP configuration provides a way to automatically add SIDs to the URI, but not automatically for relative paths.
Only, cookies are disabled in this extreme case, rarely encountered,
Cookie+session enough to handle the usual situation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.