Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
rendering when third party cookies are disabled/no localStorage?

i'm currently working on a chrome extension.

i want to show a simple div, or redirect to an error page when third party cookies are disabled. I'm able to use an alert to tell the user to enable third party cookies with

   try {
    if (window.localStorage) {
      console.log('cookies ENABLED');
    }
   } catch (err) {
    alert('Please enable third-party cookies');
    return <Redirect push to="/error" />;
   }

But i'd love for it to be an actual component or to redirect to component. So far I haven't found anything that works, because it's just blank, so i'm not able to do much.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Since React >= 16.8+, you can use useNavigate() hook and redirect programmatically.

// at the top-level
const navigate = useNavigate();

try {
    //
} catch (err) {
    navigate('/error');
}

Continue reading here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!