Jump to content

Quick question regarding XMLHttpRequest & Dreamweaver


Dalvador

Recommended Posts

Hi All,I'm currently working my way through the W3Schools XML-javascript tutorial - most enjoyable :) -I am at the example page that explains the XMLHttpRequest object (http://www.w3schools.com/xml/xml_http.asp)and I have used the example shown to "load an external textfile into a DIV element" - this works fine when I upload the page to my web serverbut gives me an "access-denied" message when I am trying to preview the page in Dreamweaver CS3.Does anyone know if there is a setting or something I should be using in Dreamweaver to allow me to preview locally?-I am using the local path of "C:\Inetpub\wwwroot\TestSite_2" to build the site in.I suppose this question should really be on a Dreamweaver forum - but you guys seem to really know what you're talking about.Appreciate any thoughts.

Link to comment
Share on other sites

You won't be able to execute code like that in Dreamweaver, or actually not even locally if you just double-click the file and open it in a browser. Security restrictions stop it from working in those circumstances.
Thanks for the reply, yeah I thought it might be a security issue on local machine as everything seems to work OK on the web server - I get the same problem when trying to preview a page in Dreamweaver that uses PHP too....I might try the Microsoft site to see if there is anything I could download for IIS that would allow it to run locally - I know it's only a minor annoyance but it would be nice not to have to upload every small change just to test it.many thanks again.ps: do you think this will also be a problem previewing standard XML read by js or is it just the AJAX type stuff that it objects to???
Link to comment
Share on other sites

It objects to Javascript trying to open a file on your computer. It would be a security problem if you saved some random webpage and opened it and it read files on your computer and sent them wherever it wanted, so Javascript is not allowed to open local files without changing the permission settings.The PHP issue with Dreamweaver is another issue entirely. PHP requires a web server in order to be executed, it's the web server that actually runs the PHP code. Dreamweaver doesn't have a web server, so it can't run PHP code. I have IIS installed at home where I have ASP and PHP set up with a database where I do all of my development work, it works fine there. You just need to open a browser and access the file using HTTP. You can access a web server on your local machine by going to http://localhost/ or http://127.0.0.1/.

Link to comment
Share on other sites

Oh so it isn't the XMLHttpRequest object that is causing the problem, it's because the file that I'm asking the object to return is on my local PC-I see, thanks for the explanation it's all becoming a bit clearer now.Thanks for the tip on the localhost webserver - I'll have a go at setting that up in IIS, at least I can continue with the PHP tutorials then....soooooooooooo much to learn :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...