Mobile app version of vmapp.org
Login or Join
Ann8826881

: Cannot load local resource In spring project, I am generating some pdf file automatically in my application and storing it in $CATALINA_BASE in tomcat server. The path is : D:Project_Localworkspace.metadata.pluginsorg.ecli

@Ann8826881

Posted in: #Apache #Java #Tomcat

In spring project, I am generating some pdf file automatically in my application and storing it in $CATALINA_BASE in tomcat server. The path is :

D:Project_Localworkspace.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappshappywebimagesUser.pdf


I have given one hyperlink on webpage to access this file. But when I click on that link it is giving error in Chrome console as below:

Not allowed to load local resource:D:Project_Localworkspace.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappshappywebimagesUser.pdf


What is the problem and how so resolve that?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ann8826881

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

I have given one hyperlink on webpage to access this file.


When you provide the local path to a file in your webpages, as covered here, you're making the assumption that the file exists on the client's computer or device, not on your server.

Instead of using a local file path in your hyperlink like:

D:Project_Localworkspace.metadata.pluginsorg.eclipse.wst.server.coretmp0wtpwebappshappywebimagesUser.pdf

you should store the file in a directory that's served by your web server, and then use a URL to the file that includes your hostname, like:
myserver.com/happyweb/images/User.pdf
If you do intend to serve a file locally (i.e., on the same computer), then you should use the file URI scheme. On Windows, that would look like:

file:///d:/path/to/User.pdf

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme