Home > Web Front-end > JS Tutorial > How to solve the problem of cookie reading in safari and opera embedded iframe pages_javascript skills

How to solve the problem of cookie reading in safari and opera embedded iframe pages_javascript skills

WBOY
Release: 2016-05-16 18:24:41
Original
1199 people have browsed it

The reason was found to be that the security verification of third-party cookies in these browsers is relatively strict. It needs to be confirmed that the user actively goes to the third-party website before the cookie can be read, so we added a guidance page that requires the user to click to enter our component. .
1. The homepage determines whether it is one of these browsers. If so, go to the guidance page. The reflag is to determine whether the guidance page has been visited. If it has already been booted, do not go to the boot page.

Copy code The code is as follows:

function safarireload()
{
var rehref=window.location.href;
if(jQuery.browser.safari&&<%=reflag %>=='0')
{
window.location.href='/safarireload.aspx? rehref=' rehref;
}
if(jQuery.browser.opera&&<%=reflag %>=='0')
{
window.location.href='/safarireload.aspx ?rehref=' rehref;
}
}

Backend code
Copy code The code is as follows:

public string reflag="3";
if (Request.QueryString["reflag"] != null && Request.QueryString["reflag"].ToString() != "")
{
reflag = Request.QueryString["reflag"].ToString().Trim();
}
else
{
reflag = "0 ";
}

2. The rehref of the guide page is the page you want to go back to

Backend code
Copy Code The code is as follows:

protected void Button1_Click(object sender, EventArgs e)
{
if (Request.QueryString["rehref"] ! = null && Request.QueryString["rehref"].ToString() != "")
{
kaixindo.syslog(Request.QueryString["rehref"].ToString());
Response. Redirect(Request.QueryString["rehref"].ToString() "&reflag=1");
}
}

Use js on the boot page to get the parameter rehref of the web page url. Page performance is better. But that’s it for now.

We welcome corrections if the code is redundant or inefficient. Hope it helps some people.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template