0

I'm working on a friend's website and I need to know how to disable the header of a webpage when he clicks on a link. His main page has several navigation links at the top, and an iFrame that is targeted by those links so that it loads in the iFrame. All of his pages also have a header in each webpage. Is there a way to disable the header when they click on the link, but the header is visible if the user just goes to the webpage. Like, if the user clicks on the "Shows" link in the navigation, the Shows webpage won't have the header, but if he types in index.html/shows, then it will have the header.

I was thinking along the lines of this for the link code

<a href="shows.html&header.visibility=hidden" title="Shows" target="target_frame">Shows</a>

but I'm not sure that's right.

2 Answers2

1

If you can, it's really best to avoid iframes for content coming from the same source.

That said, can you not just remove the target from your links and load the entire other page with the navigation?

Lee Dykes
  • 1,017
  • 8
  • 16
  • The problem is, he has an audio stream that he wants to keep streaming even after the user goes to a different page. The way he has it now, when the audio stream loads, buffers and plays on the main page, as soon as the user goes to a different page, the audio stream has to rebuffer and reload, which is precisely what he doesn't want to happen. I thought that the easiest way to do that would be to use an iFrame and have that change the content of the page. – DaCodeMonkey01 May 04 '16 at 15:06
  • hmm, that's an entirely different question. It always helps to have this kind of context. I may come back with something for this. – Lee Dykes May 06 '16 at 19:20
  • All right, let me know what you find out. In the meantime though, is there a way to disable headers so that it will load in an iFrame without it? – DaCodeMonkey01 May 10 '16 at 15:15
0

Without getting bogged down too much in implementation detail, what you want is possible.

You could do this server-side, but from the sounds of your setup it may well be very a involved process to do "correctly".

You could also do this with on-page JS -- detect a query string like ?noheader and then run a script to remove or hide the header element (document.querySelector( '.header' ).style.display = 'none';).

Or, you could try what @retroGiant has suggested, which will be a lot simpler than either of my other suggestions and should work with minimal modification to your existing setup.

SimonR
  • 1,248
  • 9
  • 10
  • I don't mind if it's a very involved process. I can try that and see what happens. And read what I replied to @retroGiant's comment to see why I don't want to do that. If you know of a way for him to keep streaming even after going to a new webpage, then I'm all ears. – DaCodeMonkey01 May 04 '16 at 15:07
  • Looking at your response to @retroGiant my initial thoughts on a server-side solution would not apply. However, you could do something along similar lines to the JS solution -- pass a GET param in the url and show/hide the header depending on that. How complicated that would be depends on the setup - the ideal will be if you have an include for the header that's on every page, you could then just stick the check in there. – SimonR May 04 '16 at 15:11
  • With regards to the carrying on streaming I reckon, from playing around with the various new browser APIs, that there's probably something clever you could do in JS to save the position at the point of changing page and resume the stream when the next page loads, but that would still have a second or two of no audio. Is it possible to convert the whole thing into a single page "app"? That could well be cleanest solution – SimonR May 04 '16 at 15:16