0

i've searched the forums for a solution, but i couldn't find anything :) i have a fancybox with a div inside it. inside this div i have things such as images, text and an external link ( tag ) to a website (ex. yahoo) what i would like is, when i click the link, yahoo will open up in a new tab/window ( target:_blank ) but all i get is "the requested content cannot be loaded. please try again later"

here's the code:

<a class="fancybox" href="#content"></a>
<div id="content">
      <img.... />
      <p>......</p>
      <a href="www.yahoo.com" target="_blank">yahoo.com</a>
</div>

thanks a lot for helping me out :)

Laura --
  • 1
  • 1
  • Possible duplicate: http://stackoverflow.com/questions/8913583/fancybox-returning-the-requested-content-cannot-be-loaded-please-try-again-lat – Badger Cat May 21 '12 at 13:51

2 Answers2

2

The browser takes www.yahoo.com as a relative url to your site, if you take a look to the address bar after clicking that link you'll see something like http://mysite.com/www.yahoo.com

You need to put the url in this format

<a href="http://www.yahoo.com" target="_blank">yahoo.com</a>
Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
  • Correct, if this link is inside your inline content (opened in fancybox), then yahoo will open in a new window/tab ... not inside fancybox!! – JFK May 21 '12 at 23:47
1

You have 2 problems:

The href attribute on your anchor is missing the http:// protocol, it should be http://www.yahoo.com:

<a class="fancybox" href="#content"></a>
<div id="content">
      <img.... />
      <p>......</p>
      <a href="http://www.yahoo.com" target="_blank">yahoo.com</a>
</div>

Also, some sites like Facebook, Yahoo or similar cannot be opened with fancybox, they're protected against iframes.

Skatox
  • 4,237
  • 12
  • 42
  • 47