2
home reload page reload page
   Log in and join conversation.

sign up forgot login?

2 comments on forums.realmacsoftware.com/t/certain-url-is-not-loading-in-iframe-cant-figure-out-why/12400/5


Certain URL is not loading in iFrame - can't figure out why - RapidWeaver / General - Rapi

The workaround So, I decided to work on a workaround for this, and it turned out to be fairly simple to do. Basically, I'm using the file_get_contents PHP function to get the raw content of the page and print that to the screen. This works well, but we then need to make sure that it's loading the correct assets. If it's trying to load an image from /img/logo.jpp for example this will fail since it will be looking in the wrong location as the root when we print directly to the screen from our preview page. Below is the simply function to grab a pages content, make the required tweaks, and display it to the user. public function backdoor($url) { $parse = parse_url($url); $domain = $parse['scheme'] . '://' . $parse['host'] . '/'; $content = file_get_contents($url); $base_url = ''; $content = str_replace('', $base_url . '', $content); $content = str_replace('src="/', 'src="' . $domain, $content); $content = str_replace('href="/', 'href="' . $domain, $content); return $content; } The guys at #elevio figured it out.
&neo 2018-11-04 23:23:50

Certain URLs are not loading in an iFrame

The #X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a frame, #iframe or object. Sites can use this to avoid clickjacking attacks.
&Rob 2018-11-04 22:19:07