保留在巨大的弹出窗口中

I have an ajax popup working nicely with Magnific Popup. However the page that I am loading into the popup via the ajax call contains a hyperlink.

The only contents of the page is:

<a href="http://www.domain.com/anotherpage.html">test</a>

When I click on the "test" link "anotherpage.html" loads in the original parent window.

Is it possible for the page that this link points to to be loaded in the same popup window?

you can achive this effect by following these steps:

  1. download the html page with jQuery into a temporay variable
  2. from the variable get the link address
  3. send Magnific Popup the link you want to display in the first place

for the first part, you can you this great post on stackoverflow: How do I load html into a variable with jquery

for the second task, all you need is to query the first (and only) link in your html page and get it's href attribute:

var target = $('a:eq(0)').attr('href'); 

now that 'target' variable stores the requested url - send it over to Magnific Popup

include a empty iframe in the popup.

create a function onclick in Test for change the src of iframe and hide or destroy the old thinks in the popup,