![]() ![]() but I'm posting this code just to demonstrate that this is a fairly simple way around this limitation. Phew ! Again - there is a reason why Chrome throws this " Not allowed to load local resources" exception, so tread carefully with this. This Handler code loads the file, then passes it's contents back in the HTTP response.Īnd, job done, the webpage opens the external file. ashx file, passing it the path+filename of the file we want to open. Now, when a user clicks on one of my Shortcut links, it calls the OpenAnExternalFile function, which opens this. $scope.OpenAnExternalFile = function (filename) ", filename)) Ĭ() The solution was to replace those elements with this code, to call a function in my Angular controller. Originally, my webpage was attempting to directly create an element pointing at the files, but this produced the " Not allowed to load local resource" error when a user clicked on one of these links. ![]() This webpage uses AngularJS 1.x to list the various shortcuts. but of course, Chrome's error prevents this. When they click on one of these shortcuts, we want to open these files. Our in-house app has a webpage where users can create a list of shortcuts to useful files spread throughout our network. It uses ASP.Net (rather than JavaScript, which this question was based on) but it'll hopefully be useful to someone. Okay folks, I completely understand the security reasons behind this error message, but sometimes, we do need a workaround. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |