NS_BINDING_ABORTED Shown in Firefox with HttpFox
Asked Answered
F

18

136

I am seeing some of the server calls (Used for tracking purpose) in my site getting aborted in Firefox while seeing through HttpFox. This is happening while clicking some link that loads another page in the same window. It works fine with popup. The error type shown is NS_BINDING_ABORTED. I need to know is the tracking call is hitting the server or not. It works perfectly with Internet Explorer. Is it any problem with the tool? In that case can you suggest any that can be used in Firefox too.

Fireplug answered 1/4, 2009 at 8:21 Comment(0)
C
64

Because your server is not sending HTTP Expires headers, the browser is checking to see if what is in its cache is current.

The way it does this is to send the server a request saying what the date of what it has in the cache is, and the server is sending 304 status telling the client that what it has is current. In other words, the server is not sending the entire content again but instead sending just a short header to say the existing cache content is current.

What you probably need to fix, is to add Expires headers to what you are serving. Then you will see the NS_BINDING_ABORTED message change to (cache), meaning the browser is simply getting content out of its cache, knowing it has not yet expired.

I should add that, when you do a FireFox forced refresh, it assumes that you want to double-check what is in the cache, so it temporarily ignores Expires.

Cosme answered 25/2, 2014 at 11:35 Comment(4)
I've run into a similar problem and expiring/disabling the cache did not fix it.Equatorial
Mike's answer below led me to the solution. I had to call preventDefault before setting a new url -- calling it afterwards was no good.Equatorial
@PaulKienitz I got it working by 🗹ing "Disable Cache" in Firefox's Web Developer Tools.Glabrous
In Django, you can do this using - ` # Create your response response = HttpResponse('Your response content') # Add the custom header indicating the binding was aborted response['ns_binding_aborted'] = 'aborted' return response `Vaal
P
43

You shouldn't be worried just because you see something that looks like a failure code (NS_BINDING_ABORTED).

In one post a Firefox developer confirms that NS_BINDING_ABORTED is simply an indication that a page load has been stopped.

It seems perfectly normal that opening a page while another page is being loaded cancels the loads on the first page. It doesn't necessarily mean the loads were aborted before the request got sent to the server, which seems to be what you care about.

[edit: reworded & removed the bit about me not being familiar with HttpFox, as people who see this in 2022 are probably not using it anyway.]

Prepotency answered 29/10, 2009 at 9:28 Comment(0)
D
11

In my case, same NS_BINDING_ABORTED error, but it was because a "button" element, which I clicked to trigger an event, was missing the attribute "type" value "submit" = How to prevent buttons from submitting forms

Donny answered 12/5, 2021 at 2:5 Comment(3)
Thanks. I know better, but fell into the same trap. Same error message in the Network tab of browser tools. I saw the page reloading, but thought the browser was mildly crashing on my code. Totally makes sense though...the button is submitting a form causing the reload.Metrorrhagia
Hey that solved it for me as well. I just added type="button" to my button to make it work!Toxicity
Life saver, after a day's futile debugging of why Firefox blocks and aborts my request (while Chrome sends it perfectly).Ite
S
10

What other javascript do you have on the page? Some javascript might be firing causing the request to be aborted.

I noticed the same thing in my application. I was redirecting the page in javascript (window.location = '/some/page.html') but then further down the block of code, I was calling 'window.reload()'. The previous redirection was aborted because window.reload was called.

I don't know what tracking you are using but it's possible that the request is being sent to your server but the request is aborted because another request was issued afterwards.

Spanjian answered 29/7, 2010 at 22:15 Comment(0)
A
7

I have experienced a similar problem, but have identified the cause.

I have a link in the first cell of a table row, and some Javascript that replicates that link across the other TD's of the row. When I click on the 'real' link (in the first cell) I get this unwanted side-effect; when I click on other cells in the row, all is fine. I feel it's because the script is adding a second link to that first cell, when it already has one.

Hence, two instantaneous requests for the same page, with the first being aborted by the second.

This technique is fairly common, so something to look out for.

Auntie answered 9/11, 2010 at 15:40 Comment(1)
Thanks -- this led me in the right direction. Turns out I had to do event.preventDefault and event.stopPropagation before going location.href = newurl, not after.Equatorial
C
4

This is probably not the case of the OP here, but one of the reasons for seeing NS_BINDING_ABORTED in Firefox is when the HTML of the page has responsive images.

These are <img> tags with srcset and sizes attributes.

Take this HTML as an example:

<img srcset="
        cheetah-400w.jpg 400w,
        cheetah-500w.jpg 500w,
        cheetah-600w.jpg 600w,
        cheetah-800w.jpg 800w,
        cheetah-1000w.jpg 1000w,
        cheetah-1200w.jpg 1200w,
        cheetah-1500w.jpg 1500w,
        cheetah-1800w.jpg 1800w,
    "
     src="cheetah.jpg"
     sizes="
        (max-width: 768px) 100vw,
        400px
     "
     alt="Cheetah"
/>

In Firefox it will download only one of the files in the srcset attribute and show NS_BINDING_ABORTED for all others.

You can read more about it the "Optimising images for High DPI displays" article on pixboost.com/, which is also the source of the above code.

Cucurbit answered 12/9, 2023 at 9:59 Comment(0)
F
3

The error NS_BINDING_ABORTED can have a variety of reasons.

In my case it was garbage in the response headers received from the server, basically a HTTP protocol violation.

Using a web debugging proxy such as Fiddler may sometimes reveal such issues better than the browser's own debugging console (which today does what, I assume, HttpFox did, just better), or at least show more detailed information or clearer error messages.

Flynt answered 17/3, 2021 at 15:43 Comment(3)
This is the most correct explanation. Indeed there are oo reasons why this could occur, but one thing that you should always check, is the "Network" logs in Firefox built-in Dev Tools. Make sure to also enable Persistent Logs, in the settings cogwheel, so you don't miss event when a page refreshes or reloads something. The thing to look out for are 401 authentication issues.Malignity
What, more specifically, would garbage in the response headers look like ?Earpiercing
@Earpiercing Anything that violates the HTTP protocol, such as invalid syntax. I don't remember the concrete example I was dealing with. You will hardly be able to produce a "garbage" response with a web API framework, but you certainly can if you have to deal with a home-brew web API framework such as I had to...Flynt
U
2

NS_BINDING_ABORTED error - Best Approach -Using a JavaScript “setInterval” method with the time delay of Min ‘0’ to max ‘100’ milliseconds based on the page load, we can execute our track link request after the default page submit request is processed.

World best solution:

var el = document.getElementById("t");
el.addEventListener("click", avoidNSError, false); //Firefox

function avoidNSError(){
  ElementInterval = setInterval(function () {
 /* Tracking or other request code goes here */
  clearInterval(ElementInterval);
 },0);

};
Unbelieving answered 31/8, 2012 at 11:26 Comment(0)
S
0

I know this is a very old question but this happened to me recently with Firefox 95. The images of an ancient application made by a collegue of mine were not loaded (or loaded randomly) because of this code:

window.addEventListener('focus', function() {
   // omit other code...
   location.reload();
}

Once nested this code into a 'load' listener, the issue completely disappeared.

Syrinx answered 16/12, 2021 at 15:56 Comment(0)
B
0

in my case experience, NS_BINDING_ABORTED occurred because missing closed tag between <form>...</form> example:

<form name="myform" action="submit.php" method="post">
    <div class="myclassinput">
        <input type="text" name="firstname">
        <input type="text" name="lastname">
        <input type="submit" value="Submit">

</form>

there is I am forget to write closing </div> tag before </form>.

Brunt answered 7/4, 2022 at 1:45 Comment(0)
O
0

I note my experience here, just in case... For me it was a website on a local dev server (adress 192.... etc) which was put online on an already used URL like www.something.com The consequence was that an MP4 video (through the H5P library) didn't play, but allowed to be scrolled through the progress bar. And when I copy/paste the URL to this video, this NS_BINDING_ABORTED error appeared on my laptop, while my colleague on the same internet connection had no problem to view it.

I made an ipconfig /release and /renew, then restarted my computer, and it was fixed... maybe it was some old data conflict with the previous content on this already used URL domain? I don't know.

Oxysalt answered 23/9, 2022 at 4:38 Comment(0)
B
0

For me reason was in Firefox browser preventDefault function not worked in form submit event. This answer helped to solve: https://mcmap.net/q/168633/-how-can-i-prevent-form-submission-page-navigation-on-artificial-submit-event-in-firefox

Blubbery answered 16/2, 2023 at 14:20 Comment(0)
K
0

In my case I had a page that would just redirect to a native application and the redirect was triggered before the "onPageLoad" event. That redirect was forcing Firefox to abort the page from loading, so no images would be loaded.

Waiting for the page to load resolved the problem.

Same behavior was not seen on Chrome or Edge.

Kaolin answered 24/4, 2023 at 14:44 Comment(0)
P
0

In my case this happened when I tried to do ajax request when page still loading. My code was:

<script type="text/javascript" src="/script.js"></script>

<div id="example-form"></div>

<script type="text/javascript">
    var schema =  $.ajax( ... );
</script>

I just wrapped my code into onload:

<script type="text/javascript" src="/script.js"></script>

<div id="example-form"></div>

<script type="text/javascript">
$(window).on('load', function() {
    var schema =  $.ajax( ... );
});
</script>

So, as I can see, I should not do ajax requests, when main page was not loaded yet.

Pectinate answered 30/4, 2023 at 0:11 Comment(0)
D
0

The reason this problem occurred to me is that I tried to trigger a JavaScript function that posts something to the BE using a button that was in a form.

The form has its own logic and the submit button.

However i did not know that if you add a button to a form it will automatically add it type submit. And my problem occurred by sending two requests at the same time to the server. The server couldn't handle both.

This was done in Django.

My fix was to replace the button tag with the tag and add some jQuery that calls my function on a click.

Detruncate answered 27/9, 2023 at 11:50 Comment(0)
U
0

I resolved this issue by clearing cache before my ajax call using simple javascript if you are using any another language clear cache using other language's code.

if (window.location.href.indexOf('?') < 0) {
        window.location.href = window.location.href + '?';
    }
Umberto answered 14/12, 2023 at 6:38 Comment(0)
O
0

In my case NS_BINDING_ABORTED, "Unknown Error", error: abort", was caused by aborting API GET call. I have Angular SSR and implemented TransferHttpCacheModule this prevents Firefox to call duplicate GET (on server side and again on Browser side). Behavior is correct, other browsers do not log this error.

To prove this I just commented TransferHttpCacheModule in imports in the app.module.ts. error disappeared, but of course you want to use TransferHttpCacheModule.

Overly answered 11/1 at 9:38 Comment(0)
C
0

Message NS_BINDING_ABORTED is equivalent to "Cancelled" in Chrome DevTools. From the user's perspective, this basically means a program decided to abort/cancel the current process due to lack of speed, for example, when a video player encounters a video chunk that can't be downloaded in time.

You can trigger it:

Goog luck C0ders!

Centralize answered 18/3 at 22:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.