I have a Rails 4 app. I'd like for my user to be able to click on a button and open another random website within the page they are currently on. The users could then navigate the new website and my page would maintain it's navigation bar and border around the new website.
How should I create this feature?
I have a Rails 4 app. I'd like for my user to be able to click on a button and open another random website within the page they are currently on. The users could then navigate the new website and my page would maintain it's navigation bar and border around the new website.
How should I create this feature?
Share Improve this question asked Jul 3, 2014 at 18:54 MicFinMicFin 2,5014 gold badges36 silver badges61 bronze badges 1-
So you basically want to create a
proxy
? – Richard Peck Commented Jul 4, 2014 at 10:09
4 Answers
Reset to default 5I imagine that what you desire can be achieved with an iframe
.
https://developer.mozilla/en/docs/Web/HTML/Element/iframe
Well, why don't you create an iframe and create a trigger (button in this case) to navigate that iframe. With Jquery it's simple:
Javascript (jQuery)
$("#button").click(function () {
$("#iframe").attr("src", "http://www.google./");
});
HTML:
<iframe id="iframe" src="" width="100%" height="400"></iframe><button id="button">Load</button>
try something like this. But make sure you load jQuery first :)
Proxy
What you're referring to is known as a proxy server
- quite mon functionality on the net.
There are 100's of scripts to achieve this; the simplest is to use an iframe
:
An inline frame is used to embed another document within the current HTML document.
This will allow you to render other websites / web pages within your current webpage, maintaining your styling etc.
Just make a proxy. I would just put the first part but this has to be 30 characters so ima just keep going. Just create a Proxy cuh .