Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

When i save json file in web apps then using http://localhost:8080/WGSClient/js/object.json this path file gets open.But when i keep it outside web apps like local folder then using same url format json file is not accessible.It showing error that openlayer doesn't support this url format.So what is the proper url which openlayer support or i should keep my json file in web apps?

What would be the URL of a JSON file on the local drive?

share|improve this question
1  
Do you mean file:// style URLS? –  Matthew Snape Oct 10 '12 at 14:59
    
localhost/localpath type URL –  user9125 Oct 11 '12 at 6:48

1 Answer 1

Do you mean file URIs? You can try the following format

file://host/path

For example, if you want the file fstab at /etc/

file://localhost/etc/fstab

You can also omit the host but don't omit the slash

file:///etc/fstab

I hope that helps.

share|improve this answer
    
file://localhost/etc/fstab using this URI error occurs.Access to restricted URI denied.but when i keep it in web apps then using localhost/path it runs successfully –  user9125 Oct 11 '12 at 6:45
    
Using file://localhost/etc/fstab URI code shows error that 'access to restricted URI denied'..I think openlayers doesn't supports this type of URI.May be it supports localhost type of URL –  user9125 Oct 11 '12 at 6:53
    
Can you try it for other files? fstab is a system file. What about files in your home folder? –  R.K. Oct 11 '12 at 7:50
    
file://localhost/my file path. not successfully running.same error as access denied for restricted url –  user9125 Oct 11 '12 at 9:00
1  
Browser support for these type of URLs is patchy for security reasons. Chrome especially will reject localhost and file://. Use an actual web server with real domains. It is not difficult to setup and will be better. –  Matthew Snape Oct 11 '12 at 9:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.