I have a site and in my site when user click on a specific div then a new child window open . Suppose the user is standing at xyz.com/category
, now if you user clicks on that div then parent windows goes to another url suppose google.com
and a popup window will get open and there are some more navigation in popup windows . But every page that will open in popup has a button called Go Back To Site
. I want that when user clicks on several links in popup and then click on Go Back To Site
button then popup window get closed and parent window move back to xyz.com/category
.
Asked
Active
Viewed 386 times
1

Ian
- 50,146
- 13
- 101
- 111

user2193861
- 87
- 1
- 2
- 10
-
is `xyz.com/category` always the same? – Josh Apr 10 '13 at 05:51
-
No @Josh this is dynamic , it could be anything – user2193861 Apr 10 '13 at 06:03
3 Answers
0
If you can use javascript for this, there are simple functions such as:
window.history.back();
window.history.forward();
You can refer all of them in following link:
https://developer.mozilla.org/en/docs/DOM/Manipulating_the_browser_history
For Jquery:
$(document).ready(function() {
var referrer = document.referrer;
});
For C# :
WebBrowser1.Url = new Uri("http://maps.google.com");
- document.referrer does not work for IE
For this issue refer following code:
<script type="text/javascript" >
function redirect(url) {
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
var referLink = document.createElement('a');
referLink.href = url;
document.body.appendChild(referLink);
referLink.click();
} else {
location.href = url;
}
}
</script>
This code can also be refered over here

Community
- 1
- 1

Freelancer
- 9,008
- 7
- 42
- 81
0
The way I'd do it is to pass the current URL as a parameter into your popup. So you would change your anchor link tags to this:
<a href="popup.aspx?prevPage=oldPage.aspx">Click</a>
So when your popup pops up, you just grab the value of prevPage and then when they click "Back to previous page", you just redirect to the value of prevPage.

Icemanind
- 47,519
- 50
- 171
- 296