Title: Back/forward cache feature
Last modified: September 20, 2024

---

# Back/forward cache feature

 *  Resolved [roadlink](https://wordpress.org/support/users/roadlink/)
 * (@roadlink)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/back-forward-cache-feature/)
 * Hi there,
   It seems your plugin blocks this feature.[https://web.dev/articles/bfcache?utm_source=devtools](https://web.dev/articles/bfcache?utm_source=devtools)
 * I have below error when I test it as explained in here. [BFCache Explained: Verify on your WordPress site (youtube.com)](https://www.youtube.com/watch?v=M5mqBoO772M)
 * “Pages that use WebAuthetication API are not eligible for back/forward cache.”
 * Can you check and fix if possible?
   Chat gpt’s suggestion
 * **4. 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 code`function 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 });`

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/back-forward-cache-feature/#post-18034934)
 * Thank you for trying our plugin roadlink.
 * Can you please share more details about this so we can better understand the 
   context? As in:
    1. What version of the plugin and WordPress are you using?
    2. How are you reproducing this? I am presuming you are enabling our plugin, but
       when exactly do you see this error?
    3. Have you enabled any specific settings in the brower?
 * The more information you can share with us the better we can understand this.
 * Looking forward to hearing from you.

Viewing 1 replies (of 1 total)

The topic ‘Back/forward cache feature’ is closed to new replies.

 * ![](https://ps.w.org/wp-2fa/assets/icon-256x256.png?rev=2961533)
 * [WP 2FA - Two-factor authentication for WordPress](https://wordpress.org/plugins/wp-2fa/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-2fa/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-2fa/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-2fa/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-2fa/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-2fa/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [robertabela](https://wordpress.org/support/users/robert681/)
 * Last activity: [1 year, 8 months ago](https://wordpress.org/support/topic/back-forward-cache-feature/#post-18034934)
 * Status: resolved