Three codes for automatic refresh of web pages

Time:2021-9-16

In fact, it is very simple to achieve this effect, and this effect can not even be called special effect. You just add the following code to your web page.

1. Automatic page refresh: add the following code to the < head > area

< meta http equiv = “Refresh” content = “20” >, where 20 refers to refreshing the page every 20 seconds

2. Automatic page Jump: add the following code to the < head > area

<meta http-equiv=”refresh” content=”20;url= https://www.jb51.net “>, where 20 means to jump to after 20 seconds https://www.jb51.net page

3. Automatic page refresh JS version

<script language=”JavaScript”>
function myrefresh(){
window.location.reload();
}
setTimeout(‘myrefresh()’,1000); // Specify one refresh per second
</script>

Recommended Today

The selector returned by ngrx store createselector performs one-step debugging of fetching logic

Test source code: import { Component } from ‘@angular/core’; import { createSelector } from ‘@ngrx/store’; export interface State { counter1: number; counter2: number; } export const selectCounter1 = (state: State) => state.counter1; export const selectCounter2 = (state: State) => state.counter2; export const selectTotal = createSelector( selectCounter1, selectCounter2, (counter1, counter2) => counter1 + counter2 ); // […]