in reply to Re^4: Finding out Browser History Length
in thread Finding out Browser History Length

You can't modify it via perl, since then all pages will give you the same result. You have to test for the history length via javascript, and then modify the links.

edit: this does sound like an XY problem. Depending on what you want to achieve, there may be better options.

  • Comment on Re^5: Finding out Browser History Length

Replies are listed 'Best First'.
Re^6: Finding out Browser History Length
by user2000 (Sexton) on Aug 16, 2007 at 18:35 UTC
    I read the XY problem :). Thank you for your replies. Basically I want to know if a page is opened in a new window or not. If yes, then I want to do some processing before it is outputted on the screen. My pages are like: a.pl, b.pl, c.pl. If c.pl is opened from a link in a.pl in a new window, then during the processinf of c.pl i should come to know that so that i can append some extra stuff in c.pl output. That was the reason I was trying to find out if the page is in new window using Perl and not Javascript. So that if I can find out using Perl prior to outputting it, then I can modify it suitably. Now since you have said that I can modify using javascript, I can do the modifications in a.pl so that when c.pl is loaded in new window via a.pl I come to know about it. But what are the modifications required. Please guide me. Thank you very much, Anant
      So you want to add information to the page when it's opened in a new window. You can't do that in perl, since you can only know if the window is "new" (i.e. has no history) in javascript - i.e. AFTER the page is loaded.

      I'd probably just add a javascript to each page which will add the information if the history length is 1, and leaves the page alone if not. No perl required.