Select to view content in your preferred language

iFrame and in screen window

3436
23
08-29-2018 12:06 PM
joerodmey
MVP Alum

Have a custom WAB app with a popup that provides a link for user to click on. This link brings them to a Survey123 form. Instead of opening up a new browser tab, I'm considering using the iFrame option to display the form in window.

Something like this:

map.infoWindow.setContent('<iframe  width="100%" height="1000"></iframe>');

Ideas welcomes.

Thanks,

Joe

0 Kudos
23 Replies
RobertScheitlin__GISP
MVP Emeritus

Joe,

   In the current security context of modern browsers placing things in iframes has gotten much more difficult and I would advise against it.

3 Reasons You Should Never Use Iframes 

X-Frame-Options - HTTP | MDN 

0 Kudos
joerodmey
MVP Alum

Can you suggest another option? Would you recommend the X Frame option?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Joe,

  Keep it in a new tab. X-Frame options are security policies/rules for iframes.

0 Kudos
joerodmey
MVP Alum

I wanted to remove the 2nd tab so users stay on the same tab. Are there any other options code wise?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Would replacing the contents of the current tab with the survey work for you. If not then no, nothing I can think of.

0 Kudos
joerodmey
MVP Alum

Yes but I would need to test this first. How would I go about such a process?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Set the link you are using to open the new to to have a target property of "_self"

0 Kudos
joerodmey
MVP Alum
map.infoWindow.setContent('<a href="https://survey123.arcgis.com/share/xyz123?center='+ evt.mapPoint.getLatitude().toString() + ','+ evt.mapPoint.getLongitude().toString() + '&field:Floor_Selection=' + this.SERVICE_ID.split(']')[1] + '" target="_self"><font size="4">Click here to submit a service request</font></a>');

didn't seem to work

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Try "_parent"

0 Kudos