Jump to content

Disable links in the TUniURLFrame


Tokay

Recommended Posts

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>';

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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...