0

Here is my situation. I have a new navigation menu built on an entirely different php framework than the actual site is running. Both the new navigation and the existing site are on the same domain. I tried removing the old bar and adding the new bar via an iframe:

<iframe src="/new/menu" width="100%" scrolling="no"></iframe>

This works perfectly fine except some of the menu elements have submenus. When the menu drops down, it's stuck inside the iframe and doesn't overflow the parent page.

I've looked into it and it makes sense this is a security issue with an iframe. But is there some other trick that would allow this external url to load AND overflow it's parent page?

Also, just so it's out there, this is a temporary visual upgrade the client is pushing me for. They want me to "splice" elements into place as they're completed so I definitely need to find some type of solution to make this work properly.

Any ideas will help!!

john
  • 1,330
  • 3
  • 20
  • 34
  • not possible, see http://stackoverflow.com/q/176572/866172 – Jalayn Apr 30 '13 at 17:03
  • I know it's not possible with an iframe, but is there no other way to render an external url from the same domain on the page allowing overflow? – john Apr 30 '13 at 17:05
  • if it's in the same domain, you could perform an ajax request to retrieve the content of "/new/menu" and paste it into an existing "
    " tag.. But you have to have the stylesheets and scripts available on your main page...
    – Jalayn Apr 30 '13 at 17:08
  • does your current code also use php? if so, on the server side you could make the call to the new url and grab the generated html and include it into the page. – Jonah Apr 30 '13 at 17:15
  • I tried using but it didn't render correctly. – john Apr 30 '13 at 17:20
  • A simple include likely wouldn't work. You'll need to actually make a request to get the nav using curl, and then include the results of that request into your page. – Jonah Apr 30 '13 at 17:25

1 Answers1

0

Some things you could do is First of all a php call something along the lines

$menu= file_get_contents('http://www.menuurl.com/');
echo $menu;

Second thing you could do is a javascript call preferable with jquery

$('#divToLoadInto').load('file.html');

Source:

http://api.jquery.com/load/

http://php.net/manual/en/function.file-get-contents.php

Here is some alternative solution:

- A Fully javascript solution using ajax

Community
  • 1
  • 1
Breezer
  • 10,410
  • 6
  • 29
  • 50