0

similiar How can I get the content of the file specified as the 'src' of a <script> tag? and Getting content of a script file using Javascript , I want to use script tag to load xml files for the use of a javascript code - only I need it to run locally. so how can I access the content of the files loaded using script tag?

Community
  • 1
  • 1
Oded
  • 145
  • 1
  • 7
  • You cannot load an xml file using a script tag? – Bergi Jul 03 '13 at 13:28
  • What is exactly your problem ? What have you tried from the similar posts you refer to ? What are you tring to achieve exactly ? – Laurent S. Jul 03 '13 at 13:28
  • Something like [**this**](http://www.w3schools.com/dom/tryit.asp?filename=try_dom_loadxml) ? This is the result of a thorough 2 minutes research. – Jeff Noel Jul 03 '13 at 13:31
  • possible duplicate of [Import XML with jQuery: works on server, not locally](http://stackoverflow.com/questions/16003579/import-xml-with-jquery-works-on-server-not-locally) – Bergi Jul 03 '13 at 13:32
  • Bergi - I can have the xml content in the script tag, it would work, but I want it as an external file referenced as src in the script tag. I don't want to force the user to disable security features Bartdude - yes, I tried :-) Ghillied - it took even less time to see it doesn't work with local files due to security issues :-( – Oded Jul 04 '13 at 04:30

1 Answers1

0

You can not achieve this one locally. Loading the script will execute it and won't give you access to the src so then the only option you would have is to load the file as an ajax call. But ajax calls don't work locally (due to security) .

Zo72
  • 14,593
  • 17
  • 71
  • 103
  • Actually, use script-src to link to xml files won't try to execute them (I tried using the link tag as well, btw, but it didn't work either). and my trick works when the xml is the content of the script tag and not linked as the src attribute - but it means it's static, and I want it dynamic... :-( – Oded Jul 04 '13 at 04:33