Load side.html on link to extinfo.cgi?


I know this is probably html/javascript 101, but I need to figure out how to load side.html in a frame when linking directly to extinfo.cgi.
For example, in my notifications, I want to include a link to the host/service extinfo like:

which works fine, but when you load that page directly, you don’t get the menu (side.html) in a frame.
Is there some bit of javascript I can include somewhere that will force side.html to load if not already?
or any other suggestions?


search the nagios index.html/php file and find how it’s framed. create a fake page, create frames with the same names as the nagios page, load side in the left frame and what you need in the right one. you’ll probably need some sort of php parameter to load the correct main page in the right frame.


OK, here’s what I ended up doing:
Made a copy of index.html and called it frame.html and added the following javascript code:

<script language="javascript" type="text/javascript">

origURL = parent.document.URL;
if (origURL.indexOf('?') == "-1"){
contentURL = 'main.html';
} else {
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length);

document.write('<frameset cols="180,*"><frame src="side.html" name="nav" target="main"><frame src="' + contentURL + '" name="main"><\/frameset>')


Then, I call my links as a parameter to the url like so:


Works like a charm! Only bummer is the URL in the address bar remains the same as you load new pages in the frame, but I can live with that for now.
Quick 'n dirty!
Probably the “right” way to do this would be to have some js on the cgi’s that “breaks in” to the frameset, but the above is much easier than recompiling.


consider that all nagios URLs remain the same… that’s why on pressing F5 you normally get to the start page instead of refreshing the frame… :slight_smile:

Thanks for sharing the solution.