How to disable navigation in a iFrame

I want to open an iFrame to show information on another location via an iframe.

The user is not allowed to interact with that information, it must be 'Display only'.

How can I disable this functionality in an iFrame?


hi,

did you check this document and this post and this video, correct? If not, please check, because you will find several solutions about what you need.

I hope this help you.
Cheers,
Nuno 

Nuno Miguel Verdasca wrote:

hi,

did you check this document and this post and this video, correct? If not, please check, because you will find several solutions about what you need.

I hope this help you.
Cheers,
Nuno 

Thanks for the quick reply Nuno.

I've already seen then mentioned information. Maybe I missed it but I didn't found a solution in them.

I found something about a sandbox attribute but i don't know how to pass this to the Iframe.

Cees


Hi Cees,

I haven't tried this, but you should be able to disable click events inside an iFrame using either jquery or javascript. If it doesn't work directly on the iFrame itself, trying wrapping it inside a container first.

Here are some links that provide more info:

https://stackoverflow.com/questions/36931774/how-to-disable-all-clicks-in-iframe

https://stackoverflow.com/questions/43624731/how-can-i-disable-clicks-but-still-allow-scrolling-in-an-iframe/43633536

Regards,

Nordin

Hello Cees, 

If you want to prevent the user from interacting with the content of the iFrame, I think you have two options. 

a) You cover the iFrame with a container. This way the user will not be able to click on any of the elements in the iFrame. But of course, he can just remove it from the html. 

b) You use Javascript to capture mouse clicking over the iFrame and prevent its effect. As above, the user can workaround it. 

A third option would be to you to get the data from a request in logic (fetching the html in preparation or screen action) and processing it to show in your screen directly, not with an iFrame. You have actions in the HtmRequestHandler module to request a page from the application. 

I don't think you have any other option... 

And this means that if you really want the user to jot be able to interact with the content, you probably would have to create the content yourself, instead of using an iFrame. 

At least I don't know any other way... 

Cheers

Eduardo Jauch wrote:

Hello Cees, 

If you want to prevent the user from interacting with the content of the iFrame, I think you have two options. 

a) You cover the iFrame with a container. This way the user will not be able to click on any of the elements in the iFrame. But of course, he can just remove it from the html. 

b) You use Javascript to capture mouse clicking over the iFrame and prevent its effect. As above, the user can workaround it. 

A third option would be to you to get the data from a request in logic (fetching the html in preparation or screen action) and processing it to show in your screen directly, not with an iFrame. You have actions in the HtmRequestHandler module to request a page from the application. 

I don't think you have any other option... 

And this means that if you really want the user to jot be able to interact with the content, you probably would have to create the content yourself, instead of using an iFrame. 

At least I don't know any other way... 

Cheers


Thanks Eduardo,


The first option sounds promising to me.

But how do i cover an iFrame with a container?


Cheers Cees

Hi, 

just place both the IFrame and the container inside another container.

For the outer container, give the CSS property:

position: relative;

For the inner container, give the CSS properties:

position: absolute;
top: 0;
bottom 0;
left: 0;
right: 0;

This should be enough.

Cheers.

Eduardo Jauch wrote:

Hi, 

just place both the IFrame and the container inside another container.

For the outer container, give the CSS property:

position: relative;

For the inner container, give the CSS properties:

position: absolute;
top: 0;
bottom 0;
left: 0;
right: 0;

This should be enough.

Cheers.

Thanks but i can't get it to work.

I got:

- Outer Container

      - Inner Container

      - Iframe


With the css applied to them but i still can click on the links.....

Same as i put the Iframe inside the Inner Container.





Let me just make a quick test here.

Attached.

Solution

Eduardo Jauch wrote:

Attached.


Thanks for the effort Eduardo.

It took a while but it is clear to me now.......

Cheers

Cees

Solution

You're welcome, Cees.

Cheers.