0

I've made an script for processing XML: Extracts parts of the XML-data and displays them on a HTML-/CSS-page.

Currently I use the stringified content of some arbitrary file for doing my development. Written as a string-literal into my JavaScript.

Works great. But now comes the problem:

Of course I would like to load whatever (equal-structured) XML-files. Instead of having it in my code as a string-literal.

Normally I would load the files into my script via Ajax. But I can't install a web-server on these computer.

I'm within an enterprise and it isn't possible to install any additional software. Restricted via group-policies etc. No chance. Forget it!

As far as I know it isn't possible to use Ajax without a web-server because Ajax communicates via the http-protocol.

So here's my questions:

I there (perhaps) a possibility to use Ajax without a web-server?

And in case of impossible: Have I got any Ajax-alternatives to load XML-data into my script?

2
  • If you can use google chrome you can use --allow-file-access-from-files flag to allow ajax when accessing pages from file:// protocol Commented Jun 24, 2016 at 11:12
  • @jcubic Thanks for your answer. I really appreciate it. But got only the pre-installed Internet Explorer. And everything else one doesn't get here. Commented Jun 24, 2016 at 11:16

1 Answer 1

1

You can embed your xml inside script tag in your html like this:

console.log(document.getElementById('file').innerHTML)
<script type="text/xml" id="file">
<root><foo><bar></bar></foo></root>
</script>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.