Return to Snippet

Revision: 64188
at July 12, 2013 09:07 by nshakin

Initial Code
// import.js
function HttpRequest(url){
var pageRequest = false //variable to hold ajax object
   @if (@_jscript_version >= 5)
      try {
      pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
      catch (e){
         try {
         pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
         catch (e2){
         pageRequest = false

if (!pageRequest && typeof XMLHttpRequest != 'undefined')
   pageRequest = new XMLHttpRequest()

if (pageRequest){ //if pageRequest is not false'GET', url, false) //get page synchronously 

function embedpage(request){
//if viewing page offline or the document was successfully retrieved online (status code=2000)
if (window.location.href.indexOf("http")==-1 || request.status==200)

// Usage
<script type="text/javascript">

Initial URL

Initial Description
Include any external text file within html; HTML, CSS and Javascript all work.

Initial Title
Ajax File Include

Initial Tags
ajax, javascript, js

Initial Language