Cant use iframes on website

so i have a website that make use of iframes to stream some videos that i upload.
and then i view the site with github i can view the site normally without any problems but when i open the website with the cloudflare domain the iframes and several links are been cut of the webpage itsalf. and i know its the cloudflare’s problems because the github repository that i use support iframes and outside links and i can view it perfectly fine without cloudflare domain. so how can i fix it? (p.s the website itsalf doesnt use any webserver, its just a bunch of webpages connected togather via css and JS)

If you posted a URL where we could test this, we can offer some suggestions.

ok. here is the github project: ג'וג'וטסו קיזן - silkysub
and thats the website with the domain of cloudflare: https://silkysub.com/html/jujutsu-kaisen/season-1/2-jujutsu-kaisen-S1ep5 (p.s please ignore the hebrew text.)

It looks like you’ve blocked access from the US.

fixed it.

I see the iframe is completely missing. How are you passing your Github source through to Cloudflare?

Screen Shot 2022-01-17 at 7.21.08 AM

to tell you the truth. i dont really understand cloudflare and back-end in general. i only know that the github repository doesnt translate well to the cloudflare domain and for some unknown reason it automaticlly cuts any outside links and iframes. for what it may be worth, i will paste here the build log for the cloudflare domain.

16:09:34.338 Initializing build environment. This may take up to a few minutes to complete
16:11:48.373 Success: Finished initializing build environment
16:11:48.373 Cloning repository…
16:11:49.700 Success: Finished cloning repository files
16:11:49.792 No build command specified. Skipping build step.
16:11:49.792 Note: No functions dir at /functions found. Skipping.
16:11:49.792 Validating asset output directory
16:11:50.101 Deploying your site to Cloudflare’s global network…
16:11:54.141 Success: Your site was deployed!

i hope those info bits can help.

Oh…this is Pages? @WalshyMVP to the rescue…I hope.

I have had a situation whereby I couldn’t embed a Pages/Workers site hosted element elsewhere due to the default set up in Pages/Workers.

But if this is in relation to embedding non-Pages content onto Pages then yep I think it’s time to call @WalshyMVP

1 Like

That is interesting…

So, digging in the video is being added by JS specifically the script3.js file. This file is located at /JS/script3.js whereas the HTML is located at /html/*

Now, the code looks for the episode number

let episode_page = parseInt(get_episode_num(getLocation));

get_episode_number (from anime_selector.js) does this little bit here:

m = window.location.href.slice(x+3,-5);

The second part of this slice is to remove the .html (5 chars) from the end of the URL. GitHub Pages has that .html however Cloudflare Pages doesn’t (it doesn’t use extensions for HTML)
Because there is no .html it turns jujutsu-kaisen-S1ep5 into jujutsu-kaisen- (notice how the last 5 characters are missing. These are also the 5 characters which are needed

If you change the script to remove that -5 part you’re good to go!

Here is the fixed code:

function get_episode_num(m){
    var count = 0
    m = getLocation;
    
    for (let x = m.length; x>=0; x--) {
        if (window.location.href[x] === "/") {
            m = window.location.href.slice(x+3);
            break;
        }
    }
    for (let y = m.length; y > 0; y--) { 
        if (m[y] === "-") {
            m = m.substring(y+1);
        }
    }
    for (let y = m.length; y > 0; y--) { 
        if (m[y] === "e" && m[y+1] === "p"){
            m = m.substring(y+2);
        }
    }

    return m;
}
5 Likes

thank you man.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.