My code works prefectly on Firefox, but not on Chrome. Is there a problem with jQuery .load()
on Google C开发者_如何学Gohrome?
It works fine for me - if you are running your code on your machine and not from a live website, Chrome may be disallowing the call for security reasons.
If this doesn't help, could you post what the JS console is saying?
jQuery is cross-browser - it means that it should work on every browser. but maybe it doesn't work because those reasons:
You are running it locally (not on server) and Chrome doesn't allow loading from local files.
You are valling data from ASP.net, you are using Response.Close() that close down the socket
Maybe chrome is caching the data, try putting $.ajaxSetup({cache:false}).
I ran into your exact same problem, where an jquery script wasn't working with chrome but it does work in all the other browsers.
I am yet to find a perfect solution. However I believe the problem is with chromes caching.
if you clear your cache your script will probably succeed one time, and than stop on the next load.
I solved my issue by adding a a cache buster onto the image url i was checking for download.
If you are using jquery within a chrome extension, and have selected document-start for the script processing level, much of what you expect wont work correctly because chrome is not waiting for the onload to call ready()
<script type="text/javascript">
window.addEventListener('load', function() {
console.log("window load event");
});
$(document).ready(function() {
console.log("started processing jQueries ");
}
</script>
started processing jQueries
window load event
so you can see that chrome is starting processing the script before the DOM load is complete.
The best suggestion if you need both is to not use the ready() function for chrome extensions that run-at document-start
精彩评论