问题
I am using the fancybox iframe (as can be seen here in the iframe demo) http://fancyapps.com/fancybox/demo/
Here is the code i am using
<p><a class="fancybox fancybox.iframe" href="items/item1.html"><span>Item 1</span></a>
I then have item1.html that has the following code:
<h3>Item 1</h3>
Blah blah blah text here
<a href="http://www.google.com"><img src="https://www.google.com/images/srpr/logo3w.png" width="160" height="25" border="0" alt="Google logo" /></a>
The fancybox pop up window works and pops up after clicking the items 1 link, however, once the fancybox is open and i can see the blahblah text and also the google logo, when i click the logo - the www.google.com should load but it doesn't. What am i doing wrong?
Thanks,
Daniel
回答1:
You can't open goolge inside fancybox or in any other lightbox, check https://stackoverflow.com/a/8808761/1055987 for more.
Change it to any other URL, preferably one of your own.
回答2:
Is the problem that it is opening inside the fancybox? If so you can add a target="_blank" to the href and it will open in a new tab/window. The html in your document that is iFramed will look like this:
<h3>Item 1</h3>
Blah blah blah text here
<a target="_blank" href="http://www.google.com">
<img src="https://www.google.com/images/srpr/logo3w.png" width="160" height="25" border="0" alt="Google logo" />
</a>
回答3:
Web sites with sensitive user data often block framing by adding an HTTP header callled X-Frame-Options to their pages to prevent clickjacking attacks. There isn't much that you can do about it, other than proxying the page through your own server.
来源:https://stackoverflow.com/questions/10805385/fancybox-opening-hyperlinks-in-same-popup-window