20
Views
2
Comments
Solved
How to disable text selection in a PWA
Question

Since PWA is actually application running in browser, I want to make it to have more native feel. I want to disable user to select text that usually will prompt user to 'select all', 'copy', 'paste' 'search' and so on. How do I disable this function.

2025-12-12 06-45-53
Nandhakumar Sureshbabu
Solution

Hello @Muhammad Faiq Roslan,

You can use the CSS code suggested by Vipin, but instead of applying it to the body tag, try using the * selector, as it is a global selector. This way, it will work across the entire application.

Cheers,
Nandha.


2024-12-02 13-16-47
Vipin Yadav

Hi @Muhammad Faiq Roslan ,

I have added below CSS, To put it into action and take effect to the whole application, you would create a style in the Body tag:

This code goes into the css stylesheet for the body tag:

body {

-webkit-user-select: none;

-moz-user-select: none;

-ms-user-select: none;

user-select: none;

}

Thanks,

Vipin Yadav

2025-12-12 06-45-53
Nandhakumar Sureshbabu
Solution

Hello @Muhammad Faiq Roslan,

You can use the CSS code suggested by Vipin, but instead of applying it to the body tag, try using the * selector, as it is a global selector. This way, it will work across the entire application.

Cheers,
Nandha.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.