Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Plugins by
I just downloaded the Media Embed plugin and trying to embed a google map inside a question and an also in an answer  but i really cant understand how it works.

I tried to copy paste the google map url eg


and even the iframe embed code like that:

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1561716.1218456167!2d-75.85227027693055!3d40.137231460220384!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c0fb959e00409f%3A0x2cd27b07f83f6d8d!2zzp3Ouc6_z4UgzqTOts6tz4HPg865LCDOl869z4nOvM6tzr3Otc-CIM6gzr_Ou865z4TOtc6vzrXPgg!5e0!3m2!1sel!2sgr!4v1500493661219" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

But both doesnt embed the map inside the question or answer field. Is the plugin code for google maps embed outdated or what i m doing wrong ?
Q2A version: 1.7.4
@scott @sama55 i need your help !

2 Answers

+1 vote

Gmap will be shown correctly on the custom page with "Admin">"Pages">"Add Page". The reason is that contents of the custom page is shown as it is without being sanitized for security. On the other hand, posts are sanitized by HTMLawed just before being shown. HTMLawed does not allow "iframe" tag by default. Look at qa-include/qa-base.php::qa_sanitize_html(). Below thread will be useful.


My CKEditor plugin is unnecessary. You will be able to deal with core hacking or overriding qa_sanitize_html() function.

  • 8.1 Easy solution (for Q2A beginner)
  • 8.2 Expert solution (for Q2A engineer / designer / etc)


//'elements' => '*+embed+object-form',
'elements' => '*+embed+object+iframe-form',


If you allow iframe, your site will be vulnerable relatively. It is important that registered users are trustworthy people.

i think she is talking about this plugin http://www.q2apro.com/plugins/embed and not a custom page @sama55
moved by
@sama55 i mean how can i embed a google map using the PLUGIN "media embed" ! i already installed the plugin but it doesnt embed the google map inside the question. (or answer).

+2 votes

OK. Probably, the cause is this. This plugin is very old. So there will be many other problems.

Hi @sama55 and thanks for your replies. After a lot of research i succeeded  to display the gmaps iframe without the map inside and i am getting this console error.

"Load denied by X-Frame-Options: https://www.google.gr/maps/@xxxxxxx does not permit cross-origin framing"

Any idea about this ?
Example of embed code:

However, in this case "View Larger Map" will become error.
The Google Maps Embed API must be used in an iframe.

Fix plugin:
        //'(https*:\/\/maps.google.com\/?[^< ]+)',
        //'<iframe width="'.qa_opt('embed_gmap_width').'" height="'.qa_opt('embed_gmap_height').'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$1&amp;ie=UTF8&amp;output=embed"></iframe><br /><small><a href="$1&amp;ie=UTF8&amp;output=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>','gmap'
        '(https*:\/\/maps.google.\/?[^< ]+)',
        '<iframe width="'.qa_opt('embed_gmap_width').'" height="'.qa_opt('embed_gmap_height').'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="$1&amp;ie=UTF8"></iframe>','gmap'