lake_wylie — 2010-02-02T15:00:45-05:00 — #1
We are using the sahadowbox script for our popup boxes on a site and it is working fine except for 1 case.
We have a link to pageB.php on pageA.php that has a rel="shadowbox" attribute in the a tag. If pageA is loaded and you click on the link to pageB.php it brings up pageB in the shadowbox and everything works fine.
If pageA.php is still loading and you click on the link to pageB then pageB loads in a full page not the shadowbox.
Has anyone seen this behavior?
Is there a way to prevent it without locking out the page until it is completely loaded?
Thanks for the help.
paul_wilkins — 2010-02-02T16:35:33-05:00 — #2
There are a couple of different ways.
One way is to from the head of the document, capture any onclick events and cancel them. Then once the page is loaded you can disable that capture process.
lake_wylie — 2010-02-02T16:43:19-05:00 — #3
Can we capture the onclick events that happen while the page is loading and then once the page is loaded process them instead of canceling them?
paul_wilkins — 2010-02-02T16:48:42-05:00 — #4
vali — 2010-02-02T17:03:22-05:00 — #5
Lake Wylie: that is the downside of doing it using JS.
You probably have a document.ready run a jQuery to update the links of A tags with the "sandbox" class.
If the page is not fully loaded, then the code did not run, and your URL has not changed.
If you want to make 100% sure your URLs change, you need to do it server side, using PHP.
But I would put the sandbox on some other subdomain, than the live site, and don't worry about any links (make them all absolute, starting with /).