0

I'm Showing Html Content In Iframe Using following code

var d = $(prentElem).find('#previewEmailTemplateIframe')[0].contentWindow.document;
 d.open(); d.close();
$("body", d).append(htmlPopUpContent);

now can i disable all the click events in this iframe. there is no change in domain.

Liam
  • 27,717
  • 28
  • 128
  • 190
Sameer
  • 705
  • 10
  • 25
  • Possible duplicate of [How can I disable clicks but still allow scrolling in an iframe?](https://stackoverflow.com/questions/43624731/how-can-i-disable-clicks-but-still-allow-scrolling-in-an-iframe) – Liam Jan 04 '19 at 10:44

1 Answers1

1

after some workaround i got this to work

             x = $(prentElem).find('#' + Iframe).contents();
          $(x).find('body').attr('oncontextmenu', 'return false');

for MAC machines force touch

         $(x).on('webkitmouseforcedown', function (event) {
                event.preventDefault();
                return false;
            })

            $(x).on('webkitmouseforcewillbegin', function (event) {
                event.preventDefault();
                return false;
            })

For normal click disable

            $(x).click(function (e) {
                e.preventDefault();
                return false;
            });

It does not look good but it solved my issue...so posting this if anybody faces the same !!!!

But still mozilla firefox does not allow the middle mouse button click to be disabled so this wont work there!!

Liam
  • 27,717
  • 28
  • 128
  • 190
Sameer
  • 705
  • 10
  • 25