New Http Object


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* Returns a HttpRequest object */
  2. function getHTTPObject() {
  3. try {
  4. // Opera 8.0+, Firefox, Safari
  5. return new XMLHttpRequest();
  6. } catch (e){
  7. // Internet Explorer Browsers
  8. try{
  9. return new ActiveXObject("Msxml2.XMLHTTP");
  10. } catch (e) {
  11. try{
  12. return new ActiveXObject("Microsoft.XMLHTTP");
  13. } catch (e){
  14. // Something went wrong
  15. alert("Your browser broke!");
  16. return false;
  17. }
  18. }
  19. }
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.