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
An iframe, short for inline frame, is an HTML element that contains another HTML document within it. The iframe element is specified with the iframe tag. It may be placed anywhere in an HTML document, and thus anywhere on a web page.
You can embed an entire webpage as an iframe in a new Google site. This will allow you to pull in content from other websites and Google tools like Apps Script, Data Studio, and App Maker, saving you the trouble of duplicating and updating that information on your page.
To embed an iframe in a content page, select Interactive layout, choose the HTML block and paste the iframe code there. You can adjust the iframe width and height properties. To embed an iframe using the Old (Classic) editor, click on the Embed Media icon and paste the code in the appropriate field.
To navigate URL in iframe with JavaScript, we have to set the src attribute or return the value of src attribute in an iframe element. The src attribute defines the URL of document that can be shown in an iframe. Absolute URL: It points to another website (For example: https://www.geeksforgeeks.org/c-plus-plus/).
I figure out that opening the html file as localhost:3000/test.html was the answer, thanks to @absurdhero
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With