views:

30

answers:

2

Hi guys:

I get two frames, says A and B. Clicking a link in A will trigger page in B changing from URL_A to URL_B.

How do I remember URL_A, so that when users click cacnel button in URL_B, they can go back to URL_A?

how do I get mainFrame's URL in fraTopMenu?

<frameset rows="60,*" cols="*" frameborder="no" border="0" framespacing="0">  
  <frame src="/Common/Manager/TopMenu.aspx" name="fraTopMenu" 
    scrolling="no" noresize="noresize" id="fraTopMenu" title="" />  
  <frameset rows="*" cols="185,*" framespacing="0" frameborder="no" border="0">  
    <frame src="/Common/Manager/LeftMenu.aspx" name="leftFrame" id="leftFrame" 
      title="" />  
    <frame src="<%= MainUrl %>" name="mainFrame" id="mainFrame" />
  </frameset>
</frameset> 
A: 

The Http Referer might be your best bet. It is (at best) an unreliable mechanism to use as it is sent from the browser and is just as often blank.

Al W
+1  A: 

Clicking a link in frame A will cause frame B's URL to change to URL_B from URL_A

Change the frame B's URL to URL_B?back_url=URL_A instead. Now you can read URL_A from the document.location.search.split[1]

You can get the frame's url using top.frames[2].window.location.href

Amarghosh
Hi, how do I know URL_A in frame B from frame A?
Ricky
It'll be in `document.getElementById(id-of-frame-B).src`
Amarghosh
In frame A, don't I need to specifiy "top".document.getElementById(id-of-frame-B).src
Ricky
If the frames aren't nested, you can use `top.frames["frame-name"].src`
Amarghosh
otherwise you'll need to go `top.frames["outerframe"].frames["innerframe"].so-on.src`
Amarghosh
Hi, how do I get mainFrame's URL in fraTopMenu?<frameset rows="60,*" cols="*" frameborder="no" border="0" framespacing="0"> <frame src="/Common/Manager/TopMenu.aspx" name="fraTopMenu" scrolling="no" noresize="noresize" id="fraTopMenu" title="" /> <frameset rows="*" cols="185,*" framespacing="0" frameborder="no" border="0"> <frame src="/Common/Manager/LeftMenu.aspx" name="leftFrame" id="leftFrame" title="" /> <frame src="<%= MainUrl %>" name="mainFrame" id="mainFrame" /> </frameset> </frameset>
Ricky
`top.frames[2].window.location.href` @Ricky
Amarghosh