homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Javascript new window with history
want to find a way to retain the history of the parent window

 8:00 pm on Apr 20, 2003 (gmt 0)

hello ppl,

i have this problem with new windows.

when i open a new window from a link say

window.open("home.html", "width=400", "height=400" "toolbar=yes" "location=yes","directories=yes","status=yes","menubar=yes","scrollbar=yes")

i get to open a new window with the dimensions but not the history of the previous window.

say my previous window has a page email.html from which i opened a new window called thanx.html......

now what i want to do is retain the history of the window that opened the thanx.html window.

can i do that plz help,
Praneeth Medukonduru



 8:51 pm on Apr 20, 2003 (gmt 0)

Welcome to WebmasterWorld, Praneeth.

If by preserve the history you mean overwrite or populate the new window's history with the parent window's history, the answer is no, you can't do that. You can't even access the content of the previous history.

If browsers allowed that, it would be a serious privacy and security violation. It would allow any website to view the browsing habits of their visitors. Precautions have intentionally been written into browser code and into javascript to disallow such problems.

However, if you're only concerned about the visitor's history on your site, and if you are tracking the session with cookies, session ID's, etc., then you could, with a bit of effort, import that history information from your site into the new page for your user.

However, you still wouldn't be changing the actual history of the new window, or making the Back Button on this window echo the parent window's Back Button. And you might scare a few people with the feeling that you are spying on them.

Why not load thanx.html into the same window as email.html?


 6:42 am on Apr 21, 2003 (gmt 0)

hi tedster,

thanx for the reply.......

my problem relates to only my site...... i need to retain the history coz i usually open pages in fullscreen mode and i wanted to retain history so that i can put the back and forward buttons in the pages so that the ppl who visit can go back and forth in my site.(as the fullscreen mode dosnt have any buttons).

if u have the procedure or the script to achieve this plz do send me.

thanx again.
Praneeth Medukonduru


 7:12 am on Apr 21, 2003 (gmt 0)

Are you already tracking each user session somehow? If not, you would have a big job ahead of you to add that tracking. If you are, then you still would have to do some work collecting all the page addresses that each user visits and figuring how to write that onto the pages.

I have never done anything like this myself, I only mention it because it is at least possible. It would depend first of all on what server side languages you can use. But there would also be many odd situations to take into account: people whose browsers are not taking cookies or letting you track them for some reason; people who visit many many of your pages first, making a very large record of back links to be written on the page.

Now that I give it more thought, I think it's too much to deal with for almost all situations - it's not even close to the kind of issue where you can just add one simple script.

I think it would be better to give your visitors some good, standard navigation links for your site on the page, and include a "Close this window" button so they don't think they are trapped.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved