CodeIgniter Forums
Localhost url not working in iframe - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Localhost url not working in iframe (/showthread.php?tid=64055)



Localhost url not working in iframe - wolfgang1983 - 01-08-2016

I have a question on local host url in iframe.

I does not seem to pick the url up

PHP Code:
<iframe id="question-iframe" width="800" height="800"  src="<?php echo base_url();?>" class="form-control" allowfullscreen="true" ></iframe


It works fine with


PHP Code:
<iframe id="question-iframe" width="800" height="800"  src="http://www.w3schools.com" class="form-control" allowfullscreen="true" ></iframe


But just not localhost how can I display that with a localhost url?


RE: Localhost url not working in iframe - InsiteFX - 01-08-2016

If your on a Windows system check your IE Options, there is a setting to allow for iframes in there.

DIRECTORY_SEPARATOR equals to "/" (Unix) or "\" (Windows), and this is where the problem lies,
you cannot change this constant from ‘/’ to ‘\’ .

if (!defined('DS'))
{
define('DS', '/');
}

So if your on Windows try using a \ Creating your own base_url helper.