Issue
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?
Solution
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.com/");
});
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 :)
Answered By - Kirill Chatrov Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.