Use an iframe of a localhost app - html

I have a page of my rails app that I would like to use as an iframe on different webpage. The part of my rails app is the new view for my score object. At the moment my rails app is just locally hosted. To test my iframe, I have an HTML page in my public folder of my rails app.
Here is the test.html page
<html>
<iframe width="400" height="400" src="scores/new?site_id=191">
</iframe>
</html>
This isn't working, though. Here is the error I get when I inspect the iframe
GET file:///Users/spencerhanson/Documents/Projects/net-promoter-score/public/scores/new?site_id=191 net::ERR_FILE_NOT_FOUND
I know public/scores/new/.. isn't a place that exists in my project. I can't figure why it's trying to look there. The test.html file is in the /public/ directory. The thing here is, I had this working before, with the same src tag in my iframe. I haven't changed anything, and then one day the iframe just stopped working on my test page. I can't figure out what's going wrong. I know it's probably the src tag of my iframe, since I'm trying to display a site hosted locally on a page that is also local

I figure out that opening the html file as localhost:3000/test.html was the answer, thanks to #absurdhero

I tried sending full path like:
<iframe src="http://localhost/myfolder/photos-iframe.php?id=2"
name="thumbnails"
frameborder="0"
style="width: 100%;
height: 150px;">
and its worked for me.

Related

How to make iFrame behave exactly as if one were accessing the source site directly?

I am working on a site for a Client and they want to display the following URL in an iFrame:
https://www.vigrxplus.com/ct/3134
If you access that site directly, it will show the Promo code on the source website.
However, if you access that site via an iFrame, it will not show the Promo code on the source website:
https://jsfiddle.net/qc3zvo0b/
<iframe width="100%" height="1000" src="https://www.vigrxplus.com/ct/3134"></iframe>
(Make sure to test the iFrame without prior Cookies from having previously visited the source website directly.)
Attempting to enable all sandbox features for iFrame did not fix this.
The source site also seems to do some kind of redirect.
So how can this be fixed such that the iFrame behaves just like visiting the site directly?

Iframe links not redirecting despite correct syntax (HTA file)

I am trying to embed a website in an HTML application that has links. I've tried this:
<iframe id="frame" application="yes"></iframe>
(I haven't really figured out the size) and it worked, just you can't use links on the page. I would usually just put the code of the webpage into the hta file, but there were some problems with javascript. I need to make a multi-page site, so I need links. Is there a way to embed a website that has links onto an HTML app, and still keep the links working? Thank you for any help.

Embedded .htm iframe downloading instead of displaying

I'm using an iFrame to host an HTM form on a Wordpress page. The iframe displays the form on our site so that users can interact with it on the webpage. The .htm file is hosted on dropbox and the iframe code looks something like this:
<iframe src="https://dl.dropboxusercontent.com/spa/numbers/file/file.htm" width="1000" height="4100" frameborder="0"></iframe>
In the past, this has worked fine. The form has displayed perfectly on our site. Recently however, for some users the .htm file automatically downloads when the page is loaded, for others it displays correctly.
When viewing other stackoverflow posts, I've seen users say that the Content-Type of the .htm file needs to be 'text/html;charset=UTF-8' and after checking, that is what our files are set to.
I am completely lost. We haven't changed anything in months, so this is not the result of user error. It randomly started happening this week.

Weird IFRAME issue, page blocks itself from loading

This is a weird one. I'm using the URL "http://www.craigslist.org/about/" as an example here.
I load up that page in my browser and modify it with Firebug. I add the following line right after the body tag:
<iframe src="http://www.craigslist.org/about/" id="frame1" name="frame1" width="100%;" height="200"></iframe>
The IFRAME shows as blank! Now when I load https instead of http in the IFRAME it works. At first I thought maybe craigslist doesn't allow itself to be embedded in an IFRAME at all. Then I tried embedding that same IFRAME code on my website and the frame loads as expected.
It's as if they are blocking you from loading the same page within itself!? Anyone ever seen this behavior before?
UPDATE:
This problem appears to be related to my browser. (Firefox 21) When I try to load any IFRAME that has the same exact URL as the parent frame it fails??

What would cause an iframe to keep loading its parent page?

So this is quite the odd situation.... I have an iframe on a .cshtml page that is continuously loading the full content of the page that the iframe is on. This is the code for the iframe:
<iframe src="#Url.Content("~/dir/file.html")" width="100%" height="100%" scrolling="yes" />
The directory for the file is correct and the file.html file displays correctly without error when it is opened by itself. Also, I have tried using a different test.html file in place of file.html so the error cannot be within that file. Removing the iframe tag obviously stops this issue from occurring.
The other really interesting part about this issue is that I have a working version of the application that this .cshtml file belongs to and I have compared the corresponding .cshtml files and they are identical so I am really bewildered by this. Has anybody ever experienced a situation like this? The iframe literally just keeps reloading the .cshtml file within the iframe until I tell the browser to stop loading so you end up with a page with an iframe, that has a page withing the iframe, that has a page within the iframe, so on and so forth.
The answer to this question lies within the authentication for the application. When the iframe would make a call to file.html it would receive a redirect back to the .cshtml page which of course had the iframe on it so you can see where the loop comes into play. The solution of course then is to change the security settings to allow it to call to file.html as it needs to be displayed there. Thanks anyway.