The Little Guy Posted June 22, 2012 Share Posted June 22, 2012 Is there a header that tells the browser to wait for connections to images/js/css/etc for a certain number of seconds, then if the file doesn't respond then cancel/close the request/retrieval? Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 22, 2012 Share Posted June 22, 2012 Not that I am aware of, I would assume that the browser has a setting to wait for x number of seconds before giving up. If it was configurable from the web server I could see some scenarios where that could be exploited. It might be configurable from the client side though. But, what is the real problem? If a simple resource such as an image or css file is taking so long it times out that is a connectivity and/or server problem. But, if the actual page is taking too long then that is usually due to some very inefficient code that is taking too long to process. I see this a lot when people put queries in loops that are processing a lot of data. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted June 22, 2012 Author Share Posted June 22, 2012 lets say for kicks and giggles Google goes down, or is taking a long time to respond making the page come to a halt, and say my site is using one of their JavaScript files. The page now has to wait until the browser decides to give up and continue on. I don't know if you have ever seen this, but some times when you load a page in Chrome it says "waiting for etc1.static.domain.com" and the page just sits there because the site is down, or has too much traffic and nothing else loads (I have seen this issue with Twitter). If there was a time out of like 10 seconds we wouldn't have to wait 60 seconds for the page to decide that it can not load that item. Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted June 22, 2012 Share Posted June 22, 2012 This SO has everything to educate ya. http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted June 22, 2012 Author Share Posted June 22, 2012 This SO has everything to educate ya. http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go Sorry, that isn't what I am looking for. Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 22, 2012 Share Posted June 22, 2012 This SO has everything to educate ya. http://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go Sorry, that isn't what I am looking for. So what ARE you looking for. I think your original question has been answered. Mahngiel provided a link to a post regarding a solution to fall back to a local resource if the hosted resource is not available. But, it really doesn't cover all the possibilities you mentioned. But, then again, why would you use an externally hosted CSS file? If you are going to rely upon externally hosted content and you are concerned about that content not being available then you can simply reference the content as you do now and deal with that problem and possibly use some client-side code to use a local source as a fallback. Another option, which would take some work would be to add some logic to your PHP code to look for new content fails and have a caching system. But there could be some licensing issues to do that. Basically, when the PHP file executes it will check the current modification date of the files you have cached on your machine then read the files at the external location to see if they are new. If they are newer then you replace the cached files. Then in the actual output you have point all the references to the local content. This would ensure the user is always getting the most current files from those external resources but it would load from your server. This would definitely add some overhead - so it's important to understand how important this is to you before implementing. Quote Link to comment Share on other sites More sharing options...
xyph Posted June 22, 2012 Share Posted June 22, 2012 If you want to change client-side behaviour, stick to a client-side language. Load the external file using AJAX, where you can code client-side time-out options. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.