I programmatically create a html report, split into two frames. If the user then clicks on a hyperlink on the right hand frame the frame is replaced with the contents of the page.
This worked fine but now when i try to link to any Discogs release page such as this one it doesn't load it
Ive noticed Discogs have moved to secure http, I wonder if this is the issue. Although I can go to other https page such as this Acoustid one without a problem.
If I open the first link in a new tab using target="_blank" it then works okay but that is not what I want.
You can see root cause of this problem by opening Developer Tools in Chrome. If I got your problem right, I reproduced it in simple HTML page:
It's not a problem of HTTPs. The message says:
It means that Discogs blocks showing their content in frames in other origins than
discogs.com
. You cannot do anything with it.UPDATE#1
The foundation of the browser's security model is the same-origin policy, which protects web sites from one another. A full details example is given step by step in this tutorial: Security in Depth: Local Web Pages
In short,
LocalLinks Addon uses NEW TAB to open iframe local file:
There is also another 2 types of security problem.
Mozilla Foundation has given a great details here: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
Same Origin policy from
The same-origin policy restricts how a document or script loaded from one origin can interact with a resource from another origin. It is a critical security mechanism for isolating potentially malicious documents.
Definition of an origin
Two pages have the same origin if the protocol, port (if one is specified), and host are the same for both pages. The following table gives examples of origin comparisons to the URL
http://store.company.com/dir/page.html
:Why you should not mix http and https when using iframes?
How it works?
But why should you not do this?
1. https with http iframe
Lets start with the one you should not do: Your page is https and your iframe page is http. This scenario is called "Mixed Active Content" and is blocked by more and more browsers.
I have found a nice description from the developer from Firefox about this topic: https://blog.mozilla.org/tanvi/2013/04/10/mixed-content-blocking-enabled-in-firefox-23/
There you e.g find the following: Firefox and Internet Explorer consider frames Mixed Active Content, while Chrome considers frames Mixed Passive Content. This means that Firefox and Internet Explorer block iframes while Chrome does not (yet).
2. http with https iframe
The other way is including an iframe with a https page into a http page.
This is the way you can do but is not recommended (see below why)! If you really have no other way please try if it is working on all major browsers. I already had users with side effects when it comes to cookies or session handling!
The next section is from HTTP and HTTPS iframe:
It is generally bad practice to embed an iframe with content served over HTTPS within a page served over plain HTTP (or mix content). The reason for this is that there's no good way for the user to check they're using the HTTPS site they intend (unless the user really wants to check the source of the page).
An attacker could very well replace the content you serve like this:
with:
or even:
This is very hard to detect for the user, and defeats the security measure you're trying to put in place by enabling login via HTTPS.
So I hope you now don't mix content anymore ;).
IF YOU STILL REALLY WANT TO DO THIS: The external workaround is by default NOT working in this setup as the Javascript is than loaded from an http domain which is blocked! So to get this working you need to
For more, you can go through this link: https://stackoverflow.com/a/25189561/2293534
you can use iframe sandbox to help test an solve your problem:
allow-same-origin
Link