最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to open another website within the body of my website - Stack Overflow

programmeradmin4浏览0评论

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
Add a ment  | 

4 Answers 4

Reset to default 5

I 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 .

发布评论

评论列表(0)

  1. 暂无评论