Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed with Iframe

Status
Not open for further replies.

mjalal

Technical User
Jan 7, 2008
3
Hi
I am working on a site that uses an iframe to load all pages of the site. The index.php is the main page with links on that page loading to the center iframe. When I load the member login into the iframe and a member then logs in the cookie that is set is not recognised by the member only links on index.php When a logged in member clicks on a member only link the username password box comes up. After they re-enter their details everything works fine. Is there a way of taking that cookie out of the iframe to the main section so that the member does not need to re-enter their username and password.
James Smith
 
What language are you using for the cookie? is it server side or client side?

Is it a session cookie?

How is the login prompt produced?

Handrolled or via a platform / secure web area?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
The login works through a session cookie but the links on the main page work through a html and javascript link. The site is the links on the main page are this style <a href="member-only/quran_mp3/index.html" onclick="return loadIframe('ifrm', this.href)">The Qur'an MP3 Files</a>
The problem I think is that the two different languages won't talk to each other.
Is there anyway to load the session cookie into the main page. If the cookie is applied to the page then the style of link will not matter as there is a .htaccess and .htpassword file in the member folders that accept the username and password from the cookie.
James Smith
 
I'm not entirely sure how an iframe is treated interms of the cookie.

does an iframe load the cookie separate from the main page.

but then you are updating the iframe with the new url , so i would have thought the iframe is already validated as it was given the session cookie.

also is there a reason you are using a JS function loadIframe ? when you could use target="name of iframe" , as you are using XHTML Transitional doc type?

hmmm, someone else needs to give their iframe expertese on this one as to why the cookie is behaving the way it is.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I originally tried the target="iframe" when I first started using css and xhtml but I could not get it to work everytime in all browers. I found the js scrip and with quite a bit of work I eventually got it work the same in all browers that I use. I could not even use an external css file so it is all in the head of the index page. IE and Firefox look at little things differently. Now that I know a little bit more about all this I might go back to using the xhtml and cutting the js. This may even fix the problem with the login. The easiest way of course would be to drop the iframe all together as it appears to be a bit of a headache. It is a solution to make the pages load a lot faster and not needing to change a whole pile of links all the time but it presents problems all of its own.
Thanks for your help
James Smith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top