Select to view content in your preferred language

Use iframe to show webpage image in popup

12158
23
Jump to solution
12-22-2017 11:58 AM
BrandonPrice
Frequent Contributor

Is it possible to use <iframe src="www.google.com"></iframe> to show webpage images in an arcgis online popup?

Brandon

https://community.esri.com/community/gis/web-gis/web-appbuilder?sr=search&searchId=506a9f1c-8a7b-40c...

0 Kudos
23 Replies
BrandonPrice
Frequent Contributor

Hi Robert,

Do you also know if esri popups are only associated with layers or could one be created from a button onclick with custom contents?

something like:

var downloadbutton = document.getElementById('Download');
$(function() {
$("#esripopup").dialog({
autoOpen: false
});
$("#Download").on("click", function() {
$("#popup").dialog("open");
});

});


Brandon

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brandon,


  You can use a pop up for anything you want (just know that the map can only have one pop up showing at a time). From what ever your code is or called from, just do map.infoWindow.show.

BrandonPrice
Frequent Contributor

Hi Robert,

I still have not been able to get the iframe to show via an esri popup. This what I have so far:

var downloadBtn1 = dom.byId("Download");
on(downloadBtn1, "click", function (event) {
app.map.infoWindow.setTitle("Download");
app.map.infoWindow.setContent(
<iframe width="600" height="490" src="https://egis3.lacounty.gov/dataportal/2013/11/07/los-angeles-county-sanitary-sewers)" style="margin-left: -268px; margin-top: -326px;"></iframe>
);
app.map.infoWindow.show();
}
});

Does this look right at a glance?

0 Kudos
BrandonPrice
Frequent Contributor

Or is an infotemplate/popuptemplate more appropriate?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

You should give the show method a map point to set where the pop up is tied to. Also I have not checked but does your web page you are attempting to open in the iFrame have an x-frame-options in the header response like your Google of x-frame-options should have told you about?

0 Kudos
BrandonPrice
Frequent Contributor

I don't think so. I right clicked on the header and went to inspect. Then I went to console where it said top and couldn't find any x frame option.


Brandon

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Which is not good...

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

You are just not going to get this to work without using the same origin the app has to be the same beginning url as the iFrame. I.e. I can get http://gislap183/js/popupiframe.html to work with a iframe in the popup that has http://gislap183/js/gotoxy_sample.html 

0 Kudos
BrandonPrice
Frequent Contributor

I see. But shouldn't I still see the popup container?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I am not sure with those margins you have set in the iFrame.

0 Kudos