Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:17:10+00:00 2026-06-06T12:17:10+00:00

For chrome the event fires on page load, but in firefox it fires the

  • 0

For chrome the event fires on page load, but in firefox it fires the rightway, only when you press the backward or forward button. So how to write a script that works fine for all browsers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:17:12+00:00Added an answer on June 6, 2026 at 12:17 pm

    I’d go browser detection on this one (in fact, I did). I’m using jquery’s .data() to set a boolean flag to test against:

    // chrome fires a popstack event on page load, so do a check before proceeding
    var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
    if( is_chrome && !$('body').data('allow-popstate-action') ) {
        $('body').data('allow-popstate-action', true);
        return false;
    }
    

    I’ve added this conditional clause in the function that is bound to the popstate event, so the first time it’s called in Chrome (which is on page-load), it just exits the function without doing anything. Next time (prev/back buttons), it will work fine.

    I’m stuck with an old version of jQuery on this project, so I couldn’t use jQuery.browser.webkit, but you probably can.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm adding some <script> tags dynamically to the head element after page load. I
Edit: On further examination Firefox does not seem to be doing this, but Chrome
This function works perfectly on IE, Firefox and Chrome but when on the iPhone,
I'm hopelessly trying to activate a change() event from a Chrome content script. I've
Using a Google Chrome Extension, I would like to fire some event or somehow
In Chrome this is possible, but I don't find a way to do it
I have a page that fires several xmlHttp requests (synchronous, plain-vanilla javascript, I'd love
I have a socket.io connection using xhr as its only transport. When I load
I use content_scripts in chrome extension to catch the event of opening new site.
Telerik radlistbox fires both OnClientItemChecked and OnClientSelectedIndexChanged when an item is checked in Firefox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.