This particular topic has some answers on SO, but none of them solves my problem. I have no idea where to look here, although I suspect it's something very simple.
- When I try to open a url in a Fancybox manually (i.e. by 'physically' clicking a link) it works.
- If I however try to open it on page load automatically (i.e. by faking clicking a link), it doesn't work at all and gives me the error I mention in my title.
The HTML is simple:
<a href="http://www.mydomain.nl/url/to/whatever" class="fancybox hidden_link">test</a>
The Javascript I'm using to automatically click it, is pretty straightforward too:
$(document).ready(function() {
$(".hidden_link").fancybox().trigger("click");
});
The event goes off (a Fancybox opens), but it shows nothing more than the 'content cannot be loaded' message. I see my own page in the Fancybox when I click the link manually.
What am I missing here?
.fancybox()call on the link if you're trying to mimic the effect of manually clicking the link? Can't you just use.click()directly on the object returned by the jQuery selector? - Thor84no