Rav Posted May 30, 2016 Share Posted May 30, 2016 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? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 31, 2016 Share Posted May 31, 2016 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. 1 Quote Link to comment Share on other sites More sharing options...
Rav Posted May 31, 2016 Author Share Posted May 31, 2016 Thanks, but didn't work - the context menu appears as before. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 31, 2016 Share Posted May 31, 2016 Hi, Can you try this ?!: function frameload(sender, frame, eOpts) { sender.hideMask(); sender.iframe.contentWindow.window.oncontextmenu = function(){ return false } } Best regards. Quote Link to comment Share on other sites More sharing options...
Rav Posted May 31, 2016 Author Share Posted May 31, 2016 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 Quote Link to comment Share on other sites More sharing options...
asapltda Posted April 26, 2018 Share Posted April 26, 2018 Hi, can you give an example of how to use this component (UniPDFFrame) ? Thank you Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 27, 2018 Share Posted April 27, 2018 Hi, Hi, can you give an example of how to use this component (UniPDFFrame) ? Thank you Sorry, what do you mean? Quote Link to comment Share on other sites More sharing options...
donlego Posted April 7, 2021 Share Posted April 7, 2021 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 7, 2021 Share Posted April 7, 2021 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? Quote Link to comment Share on other sites More sharing options...
donlego Posted April 7, 2021 Share Posted April 7, 2021 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 7, 2021 Share Posted April 7, 2021 11 minutes ago, donlego said: FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload(sender, frame, eOpts){ FUniUrlFrame.ClientEvents.ExtEvents.Add('frameload = function frameload(sender, frame, eOpts){... Quote Link to comment Share on other sites More sharing options...
donlego Posted April 7, 2021 Share Posted April 7, 2021 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 7, 2021 Share Posted April 7, 2021 Please make a simple testcase to test. Quote Link to comment Share on other sites More sharing options...
donlego Posted April 7, 2021 Share Posted April 7, 2021 22 minutes ago, Sherzod said: Please make a simple testcase to test. urlframe.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 7, 2021 Share Posted April 7, 2021 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. Quote Link to comment Share on other sites More sharing options...
donlego Posted April 7, 2021 Share Posted April 7, 2021 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 Quote Link to comment Share on other sites More sharing options...
donlego Posted April 8, 2021 Share Posted April 8, 2021 15 hours 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. try the new rar urlframe.rar Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 8, 2021 Share Posted April 8, 2021 37 minutes ago, donlego said: urlframe.rar 1.45 MB · 0 downloads I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 8, 2021 Share Posted April 8, 2021 44 minutes ago, donlego said: urlframe.rar 1.45 MB · 0 downloads Sorry, it's not possible if it's on an external domain. Quote Link to comment Share on other sites More sharing options...
donlego Posted April 8, 2021 Share Posted April 8, 2021 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}}'); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 8, 2021 Share Posted April 8, 2021 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... Quote Link to comment Share on other sites More sharing options...
donlego Posted April 8, 2021 Share Posted April 8, 2021 on chrome right click the menu still apears Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 8, 2021 Share Posted April 8, 2021 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. Quote Link to comment Share on other sites More sharing options...
donlego Posted April 8, 2021 Share Posted April 8, 2021 localhost site Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 8, 2021 Share Posted April 8, 2021 Does it work as expected for FF? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.