[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Submodal DHTML Popup Script: Popup once per browser session

Posted on 2008-06-18
5
Medium Priority
?
2,890 Views
Last Modified: 2013-11-19
Hello.
I recently downloaded a DHTML implementation of a Modal window from Submodal
Sample demo can be seen here
http://www.subimage.com/dhtml/subModal/

I know how to implement it,but my problem is everytime a user visits the page using a back button or a link on the page in the same domain, it still pops up. I need help in getting the script to detect that it has displayed the Popup in the current browser session once and does not need to do it again unless the user closes and re-opens the browser.

I am not good at Javascripts but here are my thots.

1: Write a body onload or page onload script that launches the Submodal DHTML popup function and writes a cookie
2: When the page loads next time, it check to see if the cookie was created and does not call the Submodal DHTML again until the browser is closed

I have seen some popups that have a check box "do not display this next time i log on"
0
Comment
Question by:bisola_4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 16

Accepted Solution

by:
brad2575 earned 1500 total points
ID: 21812439
You can do this using a session variable if you are using a server side scripting language such as PHP or ASP much easier.

If not then you can do as you described and use a cookie.

It sounds like you already have the solution though using the cookie?  Or do you need examples of how to use cookies in Javascript?
0
 

Author Comment

by:bisola_4
ID: 21813252
hhm I use ASP.. but let me try doing this instead of the cookie method

<%
'check if cookie set, if cookie set then
%>
Some Javascript code here to Popwindow
<%
'if cookie not set simply create it
%>
0
 

Author Comment

by:bisola_4
ID: 21813568
Here is what i have done.. and it works swimingly
Thanks brad
<head>
<META http-equiv="Content-Language" content="en-us">
<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Fidelity Bank - we keep our word</title>
<script src="jscripts/fixit.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="styles/subModal.css">
<script type="text/javascript"> 
function alert() {}
</script>
<script src="jscripts/common.js" type="text/javascript"></script>
<script src="jscripts/submodal.js" type="text/javascript"></script>
<%
Dim sessionpop
sessionpop=Session("IsCookiePopped")
If sessionpop="" then	'popup is being shown for the first time
Session("IsCookiePopped")=True
%>
<script type="text/javascript"> 
function fixie(){}; 
</script> 
<!--[if gte IE 5.5]> 
<script type="text/javascript"> 
function fixie(){initPopUp();}; 
</script> 
<![endif]--> 
<script type="text/javascript"> 
window.onload = function() { 
fixie();
showPopWin('scamalert.html?id=85&archief=1', 433, 326, null, false); 
} 
</script>
<%
End if
%>

Open in new window

0
 

Author Closing Comment

by:bisola_4
ID: 31468316
brad put me on the right track,the solution revealed itself
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question