cookie在浏览器会话期间只显示弹出一次? [英] cookie to display pop-up only once during browser session?

查看:165
本文介绍了cookie在浏览器会话期间只显示弹出一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我有一个弹出窗口,我想在用户打开IE时出现在

浏览器主页面前。问题是,如果用户使用浏览器在

期间导航回主页,我希望它能再次出现
。但是,如果用户关闭了

浏览器,然后重新打开,弹出窗口应该再次出现。 (你可能已经猜到这将用于公共访问电脑。)我想尝试尽可能地抓住所有用户来获得
。我发现用户在完成工作后通常会关闭浏览器。


任何指导都会非常感激。

谢谢,

克里斯

Hello,

I have a pop-up window that I would like to appear in front of the
browser home page when a user opens IE. Problem is, I''d like it to
never appear again if the user navigates back to the home page during
their time using the browser. However, if the user closes the
browser, then reopens, the pop-up should appear again. (you may have
guessed that this will be used for public access pc''s.) I want to try
as best I can to catch all users. I find that users generally close
the browser when they are finished with their work.

Any guidance would be greatly appreciated.

Thanks,
Chris

推荐答案

文章< b8 ******** *****************@posting.google.com> ,
cm*********@nyc.rr.com 启发我们...
In article <b8*************************@posting.google.com> ,
cm*********@nyc.rr.com enlightened us with...
你好,

我有一个弹出窗口,我想在
浏览器主页面前出现一个用户打开IE。问题是,如果用户在使用浏览器的时间内导航回主页,我希望它再也不会出现。但是,如果用户关闭
浏览器,然后重新打开,弹出窗口将再次出现。 (你可能已经猜到这将用于公共访问电脑。)我想尝试尽可能地抓住所有用户。我发现用户在完成工作后通常会关闭浏览器。

任何指导都会非常感激。
Hello,

I have a pop-up window that I would like to appear in front of the
browser home page when a user opens IE. Problem is, I''d like it to
never appear again if the user navigates back to the home page during
their time using the browser. However, if the user closes the
browser, then reopens, the pop-up should appear again. (you may have
guessed that this will be used for public access pc''s.) I want to try
as best I can to catch all users. I find that users generally close
the browser when they are finished with their work.

Any guidance would be greatly appreciated.




除非你拥有主页,否则你不能使用javascript。

即使你这样做,你仍然需要cookie或会话。


你拥有主页吗?


如果您真正想要的是向用户或某些人发出的警告,比如我们在工作中有
,那么你可以查看计算机上的设置策略。 Windows

98及以上支持此类事情。您可以通过HTA,VB或其他程序发出一点

警告,然后每当IE打开时,

就会显示警告。

-

~kaeli~

为什么神风敢死队的飞行员戴头盔?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



Unless you own the home page, you can''t do this with javascript.
Even if you do, you still need either cookies or sessions.

Do you own the home page?

If what you really want is a warning to users or some such, like we have
at my work, you can look into setting policies on the computers. Windows
98 and above supports this sort of thing. You would make a little
warning with an HTA, VB, or other program, then whenever IE is opened,
the warning is displayed.

--
~kaeli~
Why did kamikaze pilots wear helmets?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


感谢kaeli。

是的,我拥有主页。我认为饼干是要走的路,但

不知道如何。我现在在一个页面上使用cookie有一个弹出窗口

(弹出窗口显示,cookie表明它不应该出现另外7天的
)。 )你知道cookie是否可以与再次关闭/打开的

浏览器绑定,而不是按时间控制?


再次感谢,

Chris
thanks kaeli.
Yes, I do own the home page. I figured cookies was the way to go, but
wasn''t sure how. I use cookies on one page now that has a pop-up
(once the pop-up shows, the cookie dictates that it should not appear
for another 7 days.) Do you know if the cookie can be tied to the
browser being closed/opened again, as opposed to controlling by time?

Thanks again,
Chris


chrism于2003年11月19日写道:
chrism wrote on 19 Nov 2003:
谢谢kaeli。
是,我拥有主页。我认为饼干是走的路,但不知道怎么做。我现在在一个页面上使用了一个弹出窗口的弹出窗口(一旦弹出窗口显示,cookie就表明它不会再出现7天了。)你知道吗? cookie可以绑定到被关闭/再次打开的浏览器,因为
反对按时间控制?

再次感谢,
Chris
thanks kaeli.
Yes, I do own the home page. I figured cookies was the way to
go, but wasn''t sure how. I use cookies on one page now that has
a pop-up (once the pop-up shows, the cookie dictates that it
should not appear for another 7 days.) Do you know if the
cookie can be tied to the browser being closed/opened again, as
opposed to controlling by time?

Thanks again,
Chris




如果你没有指定cookie的到期日期,那么一旦浏览器会话结束,它就会被删除

。你可以这样使用这个事实:


//如果没有设置cookie ...

if(!document.cookie.length)

{

// ...显示弹出窗口并设置一个虚拟饼干

document.cookie =''popup = no'';

}


如果您使用其他明确到期日期的cookie,您将不得不实际检查是否'b $ b''上面的popup''cookie存在:


if(-1 == document.cookie.search(/ popup = no / i))

{

// ....

}


可能有一种更有效的方法来搜索cookie ...


这适用于Opera 7.22和Internet Explorer 6.


Mike


-

Michael Winter
M.******@blueyonder.co.uk .inva lid(删除.invalid以回复)



If you don''t specify an expiry date for the cookie, it is deleted
once the browser session ends. You can use this fact like so:

// If no cookie has been set...
if ( !document.cookie.length )
{
// ...show pop-up and set a dummy cookie
document.cookie = ''popup=no'';
}

If you use other cookies with explicit expiry dates, you''ll have to
actually check if the ''popup'' cookie above exists:

if ( -1 == document.cookie.search( /popup=no/i ))
{
// ....
}

There might be a more efficient way of searching for the cookie...

This works under Opera 7.22 and Internet Explorer 6.

Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)


这篇关于cookie在浏览器会话期间只显示弹出一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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