13

<a href="view-source:http://stackoverflow.com">Click Me</a>

This used to work as a valid href attribute but it seems in the past few months it now shows an error in the console (I'm using Chrome):

Not allowed to load local resource: view-source: http://stackoverflow.com

I found some links from 2013 where this was once a bug in Chrome but said it was fixed.

Could someone point me to an authoritative source that can explain why this no longer works? I assume that this is security by the browser and not an angular issue (since view-source is whitelisted and used to work)

d-_-b
  • 21,536
  • 40
  • 150
  • 256
  • Check out this link-http://stackoverflow.com/questions/34901523/file-url-not-allowed-to-load-local-resource-in-the-internet-browser – Aakash Thakur Oct 07 '16 at 13:28

4 Answers4

12

Looks like Chrome and Firefox (at least) disabled this within the past year or so

I found this thread, and these release notes explaining why and provides a timeline as to when the change took place.


Related StackOverflow question: File URL "Not allowed to load local resource" in the Internet Browser

Community
  • 1
  • 1
d-_-b
  • 21,536
  • 40
  • 150
  • 256
1

Chrome responds with the "Not allowed to load local resource:" as a security protocol. I'm not sure why this used to work, but not now, though there is no real way around this unless web-security is disabled. There may be a different outcome on other browsers, but ultimately you are correct in thinking that it's Chrome's security.

User44
  • 140
  • 8
-1

If you open the DevTools after loading the page, the content of the items listed on the Resources tab may not be populated. This is also true of network requests on the Network tab. To see the fully populated resources on the Resources tab, first open the DevTools, then refresh the page, or navigate to the desired page with the DevTools open. Now select the html resource and it should be populated.

-1

The reason is that Chrome tries to preload URLs in background, to speed up your browsing experience.

campino2k
  • 1,618
  • 1
  • 14
  • 25