- This topic has 6 replies, 2 voices, and was last updated 1 year, 7 months ago by
Christopher Christou.
-
AuthorPosts
-
October 30, 2024 at 1:39 pm #31245
Hello,
How can i disable right click/open in new tab or window for a page on a menu? This is my site:
https://christopherchristou.com/
If you have a look at the menu on my site, the page WORK has the subpages drawing, painting, sculpting, in between, prints when you click on it. I want the viewer to be able to only view these subpages through the menu and not be able to right click on the page WORK and open it in another window/tab because that takes them to a random page i’ve created at the moment.
If there’s no way to disable right click, then could i just delete the page WORK or will i lose all the above pages that are within it too?
Many thanks for your help.
Regards,
C
October 31, 2024 at 2:16 am #31246Hi,
It is possible to disable right-click via the custom JS codes:
document.addEventListener('contextmenu', function(event) { event.preventDefault(); });
check how to add a custom JS via a plugin here>>.
Regards!
SeaTheme – FAQs – WordPress Customization – FacebookOctober 31, 2024 at 3:31 am #31248Thank you for your reply. Much appreciated.
Will this disable right click for the whole website or can i target specific menus and pages?
Regards,
C
October 31, 2024 at 1:15 pm #31250Hi,
welcome
It is possible to implement this disabling of right-click for a specific pages, but it is not possible to disable right-click for a specific section like menu area.
Regards!
SeaTheme – FAQs – WordPress Customization – FacebookOctober 31, 2024 at 4:48 pm #31255Sorry but i am confused.
Isn’t the menu made up of different pages that are put in a certain structure?
If i disable right clicking for a page, wouldn’t it disable right clicking for that page on the menu too?
Regards,
C
November 1, 2024 at 1:25 am #31259From the perspective of HTML code, this is not the case. The pages in the menu are just text lists and not real pages.
If right-click is disabled for a certain page (such as “About” page), the disabling is only effective on the About page. Even if the About page is on the menu, the disabling is ineffective on other pages.
Regards!
SeaTheme – FAQs – WordPress Customization – FacebookNovember 2, 2024 at 2:18 pm #31264Thank you for your reply. I will try the JS plugin then and let you know how it goes.
-
AuthorPosts
- You must be logged in to reply to this topic.
