2

I'd like to load a whole html page in a popup with the magnific popup plugin. If I try:

<a href='/page.html' class='btn' id="edit-images-btn">Edit images</a>
<script>
$('#edit-images-btn').magnificPopup({
    type: 'ajax'
});
</script>

It produces this:

enter image description here

This is graphically quite what I want but the problem is that the content of <html></html> is inserted directly into dom without being placed in a protective iframe. That can't be good. I'd like magnific popup to create an invisible iframe for the content. I get some weird js errors in console too:

Failed to load resource: the server responded with a status of 405 (Method Not Allowed) http://maps.googleapis.com/maps/api/js?key=AIzaSyBW_Py3pNsiSifVJzqL8J28LFCQ6P1KaX0&sensor=false&libraries=places&_=1389102487002
Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8008' is therefore not allowed access. http://maps.googleapis.com/maps/api/js?key=AIzaSyBW_Py3pNsiSifVJzqL8J28LFCQ6P1KaX0&sensor=false&libraries=places&_=1389102487002
XMLHttpRequest cannot load http://maps.googleapis.com/maps/api/js?key=AIzaSyBW_Py3pNsiSifVJzqL8J28LFCQ6P1KaX0&sensor=false&libraries=places&_=1389102487002. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8008' is therefore not allowed access. 

These errors are probably a consequence of the invalid html structure or maybe multiple inclusion of google maps api. Not sure. It probably will be solved by iframing the content.

clime
  • 8,695
  • 10
  • 61
  • 82
  • See http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource-w – Steven Wexler Jan 07 '14 at 14:29

1 Answers1

2

If you want to create iframe, why not to use iframe type of popup, instead of ajax?

Otherwise, if you just want to get rid of HTML and BODY tags, and leave just contents of BODY, you may parse the content in parseAjax callback http://dimsemenov.com/plugins/magnific-popup/documentation.html#ajax_type

Dmitry Semenov
  • 4,566
  • 2
  • 36
  • 39
  • Ye, I have discovered: `pattern: { index: '', src: '%id%' }` for iframe patterns. That works well. I'll need to make the iframe transparent but I think I'll manage. Thank you! – clime Jan 09 '14 at 12:14
  • Hah, it works even without that pattern. I guess it is default behaviour. Cool. – clime Jan 09 '14 at 12:17