2

When the link is click on main content using "open link in new tab..." option , I want to load the page inside main content with sidebar and header. Please see image below on what it should look like.

Thanks in advance.

Before Page before link was click.

After Page after link was clicked.

See Fiddle demo

 <a target="_blank" href="https://jsfiddle.net/bumbumpaw/2e16m0c4/">This should load href value in main content w/ Sidebar,Header and Footer</a>
bumbumpaw
  • 2,522
  • 1
  • 24
  • 54
  • check http://www.w3schools.com/ajax/ – Aschab Oct 05 '16 at 01:45
  • 5
    Possible duplicate of [How to load an external webpage into a div of a html page](http://stackoverflow.com/questions/18145273/how-to-load-an-external-webpage-into-a-div-of-a-html-page) – Michael Jones Oct 05 '16 at 01:47
  • @Aschab can you give me example please – bumbumpaw Oct 05 '16 at 03:15
  • You either redirect or you dont. You said you want to redirect, then redirect and have some modules with views, if you dont want redirect there are 3 perfectly valid answers. – Aschab Oct 05 '16 at 03:20
  • Those answers just load another page in div using click event, but when I right click and "Open in new tab..." It opens the page in full page and without the header and sidebar(only the white area). – bumbumpaw Oct 05 '16 at 03:24

2 Answers2

0

I think you must look jquery load() . It will load html content from another link and append to html element via ajax .

for example

$( "#result" ).load( "ajax/test.html", function() {
  alert( "Load was performed." );
});
Ihenry
  • 111
  • 1
  • 2
  • 12
  • Thanks but I need to redirect to new page but still sidebar and header exist on the page when I click "Open in new tab.".. – bumbumpaw Oct 05 '16 at 02:52
0

You can replace the contents of #contents with an iframe, if you want to load external pages. Demo

    $("a").on('click', function(ev)  {
    ev.preventDefault();
    $('#content').html("<iframe src='http://www.w3schools.com'></iframe>");});
Nidhin Chandran
  • 846
  • 8
  • 19
  • Thanks but I need to redirect to new page but still sidebar and header exist on the page when I click "Open in new tab.".. – bumbumpaw Oct 05 '16 at 02:52