Category : page-refresh

I am using functional component which provides authentication to the specific routes such as /home using server side authentication and local storage, happening in OnSubmit event of my of login page. Everything works fine I am getting redirected to homepage after successful login, the problem arises when I refresh the page from any route I ..

Read more

Am trying to refresh/reload page after user confirms they want to submit a form. Have tried several approaches. Can get form to submit after user selects OK in pop up confirmation box, but page doesn’t then refresh. Wonder if the second function isn’t running for some reason. <button class="form-button" type="submit" onclick="return confirmation();">Submit</button> <script> var a=foo.form.submit(); ..

Read more

I thought it would be cool if I added a language parameter to my pathing… After searching through the internet I came up with this: const routes: Routes = [ { path : ‘:lang’, component: LanguageComponent, children: [ {path : ‘main’, component : MainComponent}, /**etc**/ // FALLBACKS {path : ‘not-found’, component : NotFoundComponent}, {path : ..

Read more

my index.html looks like this: <!doctype html> <html lang="hu"> <head> <meta charset="utf-8"> <title>WebsiteName</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!– etc –> The code runs fine when i use "ng build", but when i compile it in production mode (with "ng build –prod") it seems to run fine, but when reloading it disables style.css. UPDATE: ..

Read more

HTML <body onload="load()"> <button onclick="notes()">Click Here</button> </body> JS <script type="text/javascript"> let array = []; let text = "Hello!"; function load(){ //when this function is loaded on doing refresh, the data in array becomes [0]. let y=JSON.parse(localStorage.getItem("notes")); } localStorage.setItem("note", JSON.stringify(text)); function notes() { let z = JSON.parse(localStorage.getItem("note")); array.push(z); console.log(array); localStorage.setItem("notes", JSON.stringify(array)); } </script> Each time I ..

Read more