Mobile Safari 5.0 sending me to about:blank on login/logout - javascript

When I log in, log out, or do a post I am getting a "Refused to execute a JavaScript script. Source code of script found within request on a dirt old iPad with mobile safari 5.0. This error is followed by an error from jQuery, "Result of expression 'a' [undefined] is not an object." Upon returning to the original url the page loads as normal.

I found the solution here >> http://bugs.jquery.com/ticket/13546
Looks like it is throwing a xss error incorrectly.

Related

PhantomJS stops screen capture on js error, but page renders fine in browser

How can I make PhantomJS continue to screen capture after encountering a JS error on the page? The page renders correctly in browsers, just not in PhantomJS screen capture.
1 page works, 1 page fails:
PhantomJS fails to capture the graph on this page: https://www.graf.ly/user_graphs/510.
PhantomJS is successful on this page: https://www.graf.ly/user_graphs/505.
Error:
It seems that PhantomJS encounters errors on the page and stops capturing. I run the rasterize.js script from PhantomJS's tutorial with debug mode on I get this error on the failed page:
TypeError: 'undefined' is not a function (evaluating 'function(e){this.visible=true;this.update(e)}.bind(this)')
https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js:2
https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js:2
https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js:1 in klass
https://www.graf.ly/graph_templates/55/graph.js:278
https://www.graf.ly/graph_templates/55/graph.js:11
https://www.graf.ly/graph_templates/55/index.html?dataset=1208&options=2140:177 in ready
https://cdnjs.cloudflare.com/ajax/libs/queue-async/1.0.7/queue.min.js:1 in o
https://cdnjs.cloudflare.com/ajax/libs/queue-async/1.0.7/queue.min.js:1
https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.min.js:1
https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.min.js:1 in t
https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.min.js:1 in u
This exception means that phantomjs' JS engine does not support bind function. Try to include (directly in html page or through phantomjs script using includeJs or injectJs functions) some polyfill like the one on MDN or es5-shim, etc...

XML error on Chrome but is fine on FF?

I'm using PHP to retrieve data and publish the data as an RSS feed. The script I have works fine on Firefox but not on Chrome.
This works on Firefox but not chrome:
getData.php?id=1744225&odds=1
This works on Chrome:
getData.php?id=1744225&odds=1
Chrome seems to need the full ampersand code in the URL:
"&"
The full URL is rendered in a backbone template like so:
<i class="icon-rss" id="rss"></i>
On Chrome this is the error I'm getting:
This page contains the following errors:
error on line 1 at column 1066: EntityRef: expecting ';'
Below is a rendering of the page up to the first error.
How can I prevent this error being produced on Chrome? It looks like the template has the correct code in it.
Thanks in advance.
I had that problem once - I was lazy and set up a javascript event listener that replaced the '&'s with &

Error with HTML/iframe in FireFox - Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHistory.pushState]

I am creating a small javascript simulation of a java-based (JSF) server. The bootstrap javascript file will download and parse a bunch of files using AJAX, and then generate a large HTML string. This HTML string is a full HTML document - it has a doctype, head, script includes, inline scripts, body, etc.
The reason I do not want to use the real JSF back-end is because I would like to be able to have a pure UI environment to test my code without any java/oracle server slowing me down.
I want to share my code (in a .zip file for example) with anyone and they should be able to open the page (with a small loading screen while the AJAX calls are made) in any browser without some server already installed on their machine.
The answer to that question led me to explore more - now I've run into a different error but I cannot seem to explain it.
Fiddle #1 : This one attempts to put the HTML into an iframe using the iframe's document.write. In this HTML there is a script that pushes a new history state history.pushState(null, null, hash)
Fiddle #2 : This one attempts to put the HTML into the iframe, but this time it just uses location.hash = hash
Both fiddles seem to work fine in Chrome and Safari and IE 9 - but Firefox gives the following error:
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHistory.pushState]
I don't understand this error - if you do this same code history.pushState(null,null,"#test") on any page in firefox using the javascript console in FireBug it works fine - but in this particular situation it doesn't work.
I also tried to perform document.open(); document.write(html); document.close() on the document in the current page (instead of creating an iframe), but the same problem happened - only this time if I put break points in firebug into javascript code inserted in the HTML fragment, the breakpoints don't work which would mean I could no longer debug anything in firefox. At least with the iframe approach, the breakpoints work.
Can anyone shed some light into this problem?
Here is another related question that I asked yesterday which lead to finding this error: Firefox Fail - After using document.write and update to location.hash causes page refresh
You can put this code
history.pushState(null,null,"#test")
before
document.open();
document.write(html);
document.close();
I have run into a similar issue trying to open an Ember app using history.pushState (Ember Router location: 'history' method of routing) inside an iframe. It appears the issue only occurs when doing a hard refresh (cmd + shift + r on Mac or ctrl + f5 on Windows) in Firefox. The issue only occurs for me in FireFox, works fine in Chrome and Safari with similar hard refresh.
The issue does not occur for me when navigating to the page for the first time or when normally refreshing the page (cmd + r Mac, f5 Windows). I have found many seemingly related on Bugzilla for Mozilla but many are close. This one seems to represent the same issue I am having and is still open as of current versions of Firefox (v37.0.1 at time of writing).
https://bugzilla.mozilla.org/show_bug.cgi?id=1003100

What does view-response.js in Chrome do?

When loading a page (200 OK response header), I received an error in the HTTP response add-on for Firefox:
[Exception... "File error: Not found" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: chrome://view-response/content/view-response.js :: sendRequest :: line 186" data: no]
What does that file do? (Contents pasted into JSBin here, notice how semicolons are missing.)
I was able to open it in Firefox and not just Chrome (but not Opera and IE).
That's an error with the plugin internal code, nothing to do with your code. The chrome:// is a little misleading, it's nothing to do with Google Chrome, Mozilla refers to elements of their UI engine as the "chrome".
The error is specifically around the line:
xhr.send(valueOfElement("body-textarea"))
Which is an ajax request initiated on this line:
xhr.open(valueOfElement("method-select"), valueOfElement("uri-input"), true)
...and since you are getting NS_ERROR_FILE_NOT_FOUND I presume the that URL return by the function call valueOfElement("uri-input") is returning a 404 or may be an invalid URL.
The lack of semi-colons in the JS file is (IMO) bad practice, but nothing to do with the error.
Long story short: ignore the error, there's nothing you can do about it except for add some error handling and rebuild the plugin package, which you probably can't do in a meaningful way unless you wrote the plugin.
It has nothing to do with your site code.

Firefox 'Error loading script' loading Google Analytics in FF2

The project I'm working on uses a window.onerror event handler to report user problems. I've noticed a single user that just cannot seem to load the Google Analytics script. Our site doesn't see a lot of traffic so I'm not sure how widespread this is, but so far it seems to just effect one user.
His user agent is: "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080829 Firefox/2.0.0.17".
The error message Firefox gives is: "Error loading script".
Additional note: The site references several other javascript files. However, the analytics reference is the only one to an external domain and the only script reference at the bottom of the page, just before the closing body tag.
Has anybody else run across this, or have any idea what could be the issue? Thanks!
This problem occurs when leaving a page in Firefox before all scripts have finished loading. So I assume that it is safe to ignore the error.
You don't see this error in the Firefox error console, but you can make it visible by binding an alert to the window.onerror event. Then you will be able to see the alert box for a small amount of time and get the following error in the error console:
[11:35:57.428] uncaught exception: [Exception... "prompt aborted by user" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: resource:///components/nsPrompter.js :: openTabPrompt :: line 462" data: no]
I'm using the following check to ignore this error in my onerror handler:
if (navigator.userAgent.search('Firefox') != -1 && message === 'Error loading script') {
// Firefox generates this error when leaving a page before all scripts have finished loading
return;
}
This is a rather random guess, but I wonder if the user is using an add-on like NoScript to control script execution and is not allowing scripts from Google Analytics to run. I know this is possible because it's what I do :) I don't know if that would show up as the error you're seeing.
I have a site with over 80 pages, all that employ JavaScript error trapping. My site serves well over 2000 pages a day and I get about ten "Error loading script" scripting errors each day from Firefox browsers. It is beginning to really annoy me and I am becoming convinced that it is a problem in Firefox.
I can discount the NOSCRIPT suggestion because the script loads in the head of my pages where there are no NOSCRIPT tags.
I can discount the 'external domain' suggestion because I have two sites that suffer this problem and in both cases the JS library files are located on the sites own server.
I have carefully checked every library file and web page using JavaScript Lint and I have discovered scripting errors and questionable scripting techniques. All these problems have been corrected but this has not provided any sort of cure to the "Error loading script" problem.
My pages do load several JavaScript library files that do not have this problem and the only difference is the size of the files. Most of the files are under 5KB but the problem file is 17KB.
Could the size of the library file be the problem?
Aagh!
We had the same issue and after examining our CDN logs, we discovered that Firefox triggers the onerror event when a script returns with HTTP status "304 Not Modified", so a cache hit. In fact, Firefox (tested with Firefox 12 at time of this writing), seems to trigger onerror event for all HTTP statuses except '200 Ok'. Other browsers behaved differently in our experiment: Chrome (19) triggered onerror only on '407 Proxy Authentication Required' and Opera (12) on 100, 101, 204, 4xx and 5xx.
I'm sure this is long resolved.. but to anyone who stumbles across this page: this error is triggered by firefox when an external script fails to load (it's easy to find the code that triggers this in the source code). We were catching these errors on our site and it turned out that we were returning 404s for the script, so I suggest looking at your logs as one possibly source of this error.

Categories