Back/forward cache feature
-
Hi there,
It seems your plugin blocks this feature.
https://web.dev/articles/bfcache?utm_source=devtoolsI have below error when I test it as explained in here. BFCache Explained: Verify on your WordPress site (youtube.com)
“Pages that use WebAuthetication API are not eligible for back/forward cache.”
Can you check and fix if possible?
Chat gpt’s suggestion4. Modify Plugin or Theme Code for Conditional Loading
a. Enqueue Scripts Conditionally:
- Action Steps:
- Edit the plugin or theme files to load WebAuthn scripts only on necessary pages (e.g., login or account pages).
- Example in
functions.php
:phpCopy codefunction conditional_webauthn_scripts() { if ( is_page('login') || is_account_page() ) { // Enqueue WebAuthn script wp_enqueue_script( 'webauthn-script', plugin_dir_url( __FILE__ ) . 'js/webauthn.js', array(), '1.0.0', true ); } } add_action( 'wp_enqueue_scripts', 'conditional_webauthn_scripts' );
- Note: Replace
'js/webauthn.js'
with the actual path to the WebAuthn script.
b. Defer Initialization:
- Initialize WebAuthn functionality only when the user interacts with specific elements.javascriptCopy code
document.getElementById('login-button').addEventListener('click', function() { // Initialize WebAuthn here });
- Action Steps:
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.