0

I have created two buttons and I am able to change my stylesheet once I click on these buttons. However when I go to the next page on my website the stylesheet reverts back to the original and does not stay how the user set it. I was wondering how this would be tackled...

0

1 Answer 1

2

Store preferred style in a cookie or localStorage.

If you use a cookie then you can set proper one at server which would prevent style flash.

Alternatively use script when page loads to read cookie or localStorage and append preferred stylesheet to <head> accordingly

Both methods are easy to research

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.