wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_page_reload_on_back_button_js › WordPress Function

Since4.6.0
已弃用n/a
wp_page_reload_on_back_button_js ( 没有参数 )
定义在:
文档:

Outputs JS that reloads the page if the user navigated to it with the Back or Forward button.

Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache, so the post title and editor content are the last saved versions. Ideally this script should run first in the head.


源码

function wp_page_reload_on_back_button_js() {
	?>
	<script>
		if ( typeof performance !== 'undefined' && performance.navigation && performance.navigation.type === 2 ) {
			document.location.reload( true );
		}
	</script>
	<?php
}