I am trying to use a icon I have, where when click expands like I am opening a browser and inside that expanded div "browser" pulls up a URL I attach. How do I achieve pulling up a new url thats interactive inside my original index.html without leaving my index.html or opening it on a new tab?
I know how make a div clickable to expand the screen, but not how to make that div turn into the url I want it to be without opening a new tab or leaving my index.html.
2
Answers
You can use Iframes (instead of simple div):
you can also change its look with css:
Adding to Arshaan’s answer, this may not work if the target site refuses to be iframed (see clickjacking).
If you use a
<div>
instead of an<iframe>
, you may find that you cannot load the other site via AJAX if it is not cors-enabled. Even if you can load the HTML and insert it into the<div>
, if the embedded HTML then loads Javascript, that may interact with the rest of your HTML page in unforseen ways.To summarize: This is unlikely to work in general.