Why Refused To Display In A Frame Because It Set ‘X-Frame-Options' To 'Sameorigin'?

532    Asked by AmitSinha in Salesforce , Asked on Nov 23, 2022

My requirement is to show a standard VF page into a Custom Visualforce page. I am using apex:iframe with 'src' parameter and the value as relative url to the standard VF page. However it does not give any error at compile time but at the runtime it only shows a blank page. Then I opened the developer console on the browser, and it showed an error. That says "Refused to display 'https://ap2.salesforce.com/001' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'".

This is my iframe. 

Answered by Al German

In a case where - refused to display x frame options to sameorigin For embedding youtube video into your angularjs page, you can simply use following filter for your video

app.filter('scrurl', function($sce) {
    return function(text) {
        text = text.replace("watch?v=", "embed/");
        return $sce.trustAsResourceUrl(text);

Your Answer


Parent Categories