wp-includes/functions.php:7781Outputs a small JS snippet on preview tabs/windows to remove window.name when a user is navigating to another page.
function wp_post_preview_js() { global $post; if ( ! is_preview() || empty( $post ) ) { return; } // Has to match the window name used in post_submit_meta_box(). $name = 'wp-preview-' . (int) $post->ID; ob_start(); ?> <script> ( function() { var query = document.location.search; if ( query && query.indexOf( 'preview=true' ) !== -1 ) { window.name = '<?php echo $name; ?>'; } if ( window.addEventListener ) { window.addEventListener( 'pagehide', function() { window.name = ''; } ); } }()); //# sourceURL=<?php echo rawurlencode( __FUNCTION__ ); ?> </script> <?php wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );}Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.