Solved

Iframes & Sessions

Posted on 2004-08-07
9
3,959 Views
Last Modified: 2012-08-14
Hi,

I've been coding something, and it seems that if I have multiple iframes on one page the pages they display all share the same session.

The only way I can see around this is by using seperate windows instead of iframes, which is not ideal for what I am wanting to do. Is this true that they share the same session, and if this is so, is there a way to make it so they do not?

This has had me stumped all day, and some help would be greatly appreciated :-).

Thanks again!
0
Comment
Question by:Jimmy_A
[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
  • 3
  • 2
  • +1
9 Comments
 
LVL 7

Expert Comment

by:suramsureshbabu
ID: 11742406
session is a browser based thing so if you dont close the browser the value will not die.

you can use cookies for storing the values if its possible

try out and if its useful

suresh :)
0
 
LVL 2

Expert Comment

by:kylen1010
ID: 11744270
i had this same problem and it was caused by and error in the code.  check your code again and be sure that all the > and " are in place at the end of all codes.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11744823
suresh is right, the session will remain active until the browser is closed (unless there is a time limit of the sessions which is defined in the configuration files).

You can unset session values however i cant understand why you are using sessions if you do not want the session data shared betwen the frames.

0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

Author Comment

by:Jimmy_A
ID: 11744879
Hi,

Thanks for the input guys.  Just to clarify, the pages I have inside the iframes are totally out of my control.

I'm going to instead use seperate windows, but am encountering the same problem. I'm using javascript to open new windows, and they all seem to be sharing the same session, but when I open the windows manually they do not.
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 11744893
its because the session id will be passed via a cookie.

you can delete the contents of a session but the actual session will still be active until the browser window is closed and a new one is opened.

You may wish to use cookies instead but im still not exactly sure why you want to completely terminate the session. As i said you can unset all values that were previously set in a session effectively leaving you with a blank canvas, the same session will still be active but will have no variables assigned to it so you can assign new values.
0
 

Author Comment

by:Jimmy_A
ID: 11745003
Hi,

I'm now a little confused ;-), Basically:

I am opening five new windows with javascript. Each window loads a similar page, and each of these pages has a dynamically generated image on it. On each page in the seperate windows, the dynamically generated image is the same - I am assuming this is because the new windows are sharing a session.

However, when I manually open five browser windows and input the URLs they do not share the same session. I'm not sure why the javascript opened windows are.

If there any way to make it so they do not? I just want a completely different session for these five windows.

Thanks a lot :-)
0
 
LVL 27

Assisted Solution

by:Diablo84
Diablo84 earned 100 total points
ID: 11745018
>> when I manually open five browser windows and input the URLs they do not share the same session. I'm not sure why the javascript opened windows are.

When a new browser window is opened it is classed as a new session whereas when the windows are opened via javascript the cookie information is sent via the http header which sustains the session through to the new page.

>> If there any way to make it so they do not? I just want a completely different session for these five windows.

no, because all the time you are using a single browser window (or following links to a new one) the session is being sustained.

You could however take advantage of the session and set up a variable to display a different image each time, if your working with PHP i can help you out with this, if your working with another language i can advise you but cant code for you.

With regards to your comment, "On each page in the seperate windows, the dynamically generated image is the same" there is a good possibility that this could be a caching issue (although it depends on the role the sessions are playing in the generation of the image). If the browser is loading a cached version of the page then all the images will appear the same.

There are methods of preventing a page caching so that the brwoser has to send a new request for the image/file each time it loads it. A quick google searching for your langauge + prevent caching should give you an answer for that (again, as i dont know what language your working with i cannot tell you this myself).

|)iablo
0
 
LVL 7

Accepted Solution

by:
suramsureshbabu earned 100 total points
ID: 11745097
if you can give us your actual requirements then we might be able to help you. but as said previously by me and diablo if you use javascript to open a new window you cannot kill the session.

one way the session gets killed is when the session times out.

suresh :)
0
 

Author Comment

by:Jimmy_A
ID: 11745447
Thanks guys, I guess we've established that either way is not feasable.

Thanks again for bearing with me, just FYI I'm now going to use a program that opens up new Internet Explorer processes so this problem does not occur.

I've split the points since you've both been very helpful!
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

623 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