Tokay Posted September 22, 2023 Share Posted September 22, 2023 Hi! Does it possible to prevent users from opening urls in the document loaded int the TUniURLFrame? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 22, 2023 Share Posted September 22, 2023 Hello, What document are you loading? Not an external link? Quote Link to comment Share on other sites More sharing options...
Tokay Posted September 22, 2023 Author Share Posted September 22, 2023 Self-generated with help of UniURLFrame1.HTML.Text := Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 22, 2023 Share Posted September 22, 2023 18 minutes ago, Tokay said: urls in the document HTML code example? Quote Link to comment Share on other sites More sharing options...
Tokay Posted September 22, 2023 Author Share Posted September 22, 2023 This code is enough: UniURLFrame1.HTML.Text := '<html><a href="http://127.0.0.1:8077">test</a></html> Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 22, 2023 Share Posted September 22, 2023 1 hour ago, Tokay said: UniURLFrame1.HTML.Text := '<html><a href="http://127.0.0.1:8077">test</a></html> If you create an HTML document yourself, then I don't see the point of using href at all. But in any case, advice, and one of the possible solutions: 1. You can use css styles instead of href I think. 2. UniURLFrame1.HTML.Text := '<html><a href="http://127.0.0.1:8077" onclick="return false">test</a></html>'; Quote Link to comment Share on other sites More sharing options...
Tokay Posted September 24, 2023 Author Share Posted September 24, 2023 Quote If you create an HTML document yourself, then I don't see the point of using href at all. Actually users creates this documents with arbitrary text inside and can add links to it. I want to avoid links activity. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted September 24, 2023 Share Posted September 24, 2023 16 minutes ago, Tokay said: Actually users creates this documents and can add links to it. I want to avoid links activity. How about to security settings? use it on TUniServerModule.UniGUIServerModuleHTTPCommand https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy AResponseInfo.CustomHeaders.AddValue('Cross-Origin-Opener-Policy', 'same-origin'); https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy AResponseInfo.CustomHeaders.AddValue('Cross-Origin-Embedder-Policy', 'require-corp'); https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy AResponseInfo.CustomHeaders.AddValue('Referrer-Policy', 'strict-origin-when-cross-origin'); //protect from ClickJacking Attack. AResponseInfo.CustomHeaders.AddValue('X-Frame-Options', 'DENY'); //protect from XSS (Javascript) injection - https://geekflare.com/http-header-implementation/#anchor-x-content-type-options AResponseInfo.CustomHeaders.AddValue('X-XSS-Protection', '1; mode=block'); https://geekflare.com/http-header-implementation/ AResponseInfo.CustomHeaders.AddValue('X-Content-Type-Options', 'nosniff'); other search results: https://stackoverflow.com/questions/19043528/simplest-way-to-disable-links-to-external-website First set the following event handler to detect whenever the user clicks a link in the video and is about to be navigated away from the page: "This would prevent the default action on all anchor tags (navigation in this case) and you can add your own custom handler if you want to alert the user that they are about to navigate away from the website (don't return false in that case)." window.onbeforeunload = function() { if (window.isPlayingVideo) { //return false; return "Are you sure you want to stop playing the video and leave the website?"; } } Then, whenever the user clicks the video thumbnail to open the modal player and start playing the video, set the following flag: window.isPlayingVideo = true; https://www.google.com/search?q=disable+external+links+javascript&oq=disable+external+links+javascript&aqs=chrome..69i57j0i22i30j0i390i650.8999j0j7&sourceid=chrome&ie=UTF-8&bshm=rime/1 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.