Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: disable external links #6

Open
mycloudvip opened this issue Aug 10, 2023 · 1 comment
Open

feature request: disable external links #6

mycloudvip opened this issue Aug 10, 2023 · 1 comment
Labels
good first issue Good for newcomers

Comments

@mycloudvip
Copy link

This interface is very useful for Language Learning Students, however is it quite annoying if they accidentally click on an external link, logo or right click menu, that URL gets control of the interface if it is inside an iFrame.

Is there a way to disable that?

Thanks

@Ajay-Dhangar
Copy link
Owner

Hi @mycloudvip

Thank you for your feedback and for using the interface for Language Learning Students. I understand your concern regarding accidental clicks on external links and the potential control they might gain over the interface when inside an iFrame.

To address this issue, you can consider implementing the following steps:

  1. Sandboxing iFrames: When embedding external content within an iFrame, you can add the sandbox attribute to the iFrame tag. This attribute restricts certain capabilities of the embedded content, including preventing the embedded content from navigating the top-level window.

    Example:

    <iframe src="your-external-url" sandbox></iframe>
  2. Target Attribute for Links: When adding links within the interface, make sure to include the target="_blank" attribute. This will open the linked content in a new tab or window, avoiding the issue of the external content taking control of the current interface.

    Example:

    <a href="external-link-url" target="_blank">Link Text</a>
  3. Context Menu Disabling: If the concern is with the right-click context menu, you can use JavaScript to disable it for certain elements within the interface.

    Example:

    document.addEventListener('contextmenu', function(e) {
        if (e.target.classList.contains('disable-context-menu')) {
            e.preventDefault();
        }
    });

    In this example, you would add the disable-context-menu class to elements where you want to prevent the context menu from appearing.

By combining these techniques, you can create a more controlled environment within the interface and prevent external content from interfering with it. Remember to thoroughly test the changes to ensure they work as intended across different scenarios.

Feel free to let me know if you have any questions or if there's anything else I can assist you with.

Best regards,
@Ajay-Dhangar

@Ajay-Dhangar Ajay-Dhangar added the good first issue Good for newcomers label Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants