Jump to content

Recommended Posts

Posted

Hello,

I have a simple HTML file (report) and want to show it to the user. For this purpose I use TUniURLFrame in a way like this:

uniURLFrame.HTML.LoadFromFile('c:\1.html');

It works perfect except that the browser context menu in uniURLFrame still works regardless of the boDisableMouseRightClick option in UniMainModule.BrowserOptions. It wouldn't have been a large problem but all browsers have the "Save as" option which works dreadful - the saved file is absolute nonsense.

Is it possible to disable the context menu in UniURLFrame or is there another better way of showing the prepared HTML file?

Posted

Hi,

 

If the "iframe" is in a same domain, for now you can try like this:

 

UniURLFrame1->ClientEvents->ExtEvents ... frameload fn:

function frameload(sender, frame, eOpts)
{
  sender.hideMask();
  sender.iframe.contentWindow.oncontextmenu = function(){
    return false
  }
}

Best regards.

  • Like 1
Posted

Hi,

 

Can you try this ?!:

function frameload(sender, frame, eOpts)
{
  sender.hideMask();
  sender.iframe.contentWindow.window.oncontextmenu = function(){
    return false
  }
}

Best regards.

Posted

Yes, sure.

I have just tested UniFrame demo - your code disables the context menu when it's empty. If you go to any URL or load HTML file - the menu appears again.

Maybe your code should be placed whenever UniFrame is changed? I will test it right now...

No it doesn't work either

  • 1 year later...
  • 2 years later...
Posted
On 6/1/2016 at 3:11 AM, Sherzod said:

Hi,

 

Can you try this ?!:


function frameload(sender, frame, eOpts)
{
  sender.hideMask();
  sender.iframe.contentWindow.window.oncontextmenu = function(){
    return false
  }
}

Best regards.

work on chrome , firefox fail

and how did put the event if the uniurlframe is runtime create

 

 

Posted
1 minute ago, donlego said:

and how did put the event if the uniurlframe is runtime create

For example using ClientEvents.

2 minutes ago, donlego said:

work on chrome , firefox fail

Can you make a simple testcase to check?

Posted
20 minutes ago, Sherzod said:

For example using ClientEvents.

Can you make a simple testcase to check?

      FUniUrlFrame := TUniURLFrame.Create(TabSheetNew);
      FUniUrlFrame.Name := Name + '_frame';

      FUniUrlFrame.Parent := TabSheetNew;
      FUniUrlFrame.Align := alClient;

      FUniUrlFrame.OnFrameLoaded := UNIFRAME_LOADED;
      FUniUrlFrame.ScreenMask.Target := FUniUrlFrame;
      FUniUrlFrame.ScreenMask.Enabled := true;
      FUniUrlFrame.URL := report_url;

   

   FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload(sender, frame, eOpts){  sender.iframe.contentWindow.window.oncontextmenu = function(){return false}}');

up raise error on runtime

image.png.bdc1b4c3b9c54c3b8fb9fe05bd6536cf.png

 

Posted
11 minutes ago, donlego said:

FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload(sender, frame, eOpts){

FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload = function frameload(sender, frame, eOpts){...

Posted
2 minutes ago, Sherzod said:

FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload = function frameload(sender, frame, eOpts){...

      FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload = function frameload(sender, frame, eOpts){  sender.iframe.contentWindow.window.oncontextmenu = function(){return false}}');

the code is work but right click on frame is show/active

Posted
4 hours ago, donlego said:

urlframe.rar 1.46 MB · 1 download

If you don't have access to the iframe's contents, in your case I suppose that's what it is, then it is not possible.

Posted
36 minutes ago, Sherzod said:

If you don't have access to the iframe's contents, in your case I suppose that's what it is, then it is not possible.

please try url without https or if u have a local web server

Posted
actually a local url, just make a test if it's an external domain for tes the funcion

   FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload = function frameload(sender, frame, eOpts){  sender.iframe.contentWindow.window.oncontextmenu = function(){return false}}');

Posted
58 minutes ago, donlego said:

actually a local url, just make a test if it's an external domain for tes the funcion

Sorry, maybe I misunderstand your case, if you are using a local url, then this should work as expected...

Posted
2 minutes ago, donlego said:

on chrome right click the menu still apears

 

1 hour ago, Sherzod said:

Sorry, it's not possible if it's on an external domain.

But in your case, you open a different domain in the frame.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...