Im in a page mainpage.aspx" in which i have this code:
<a rel="facebox" href="destination.htm?path=blabla">mainpage</a>
Im using facebox() to load the destination.htm
The problem is in my destination.htm,when im trying to hit an alert(window.location.href) im getting the mainpage.aspx and not the destination.htm.why ? all i want to do is to read the path from the page to get the querystring (but im getting the wrong path).
thanks alot
That is because facebox is not actually redirecting the browser to that page, but fetching via ajax and injecting it into the facebox div on the same page.
You could try grabbing the href attribute of the anchor instead, perhaps something like:
var lastVisited = null;
var lastVisitedQS = null;
$("a[rel='facebox']").facebox()
.click(function() {
lastVisited = this.href;
// you can extract the query string like this
var a = document.createElement('a');
a.href = lastVisited;
lastVisitedQS = a.search; // should give path=blabla
});
and then in your destination.htm
do:
alert(lastVisited);
alert(lastVisitedQS);
Hope that helps!