Search code examples
javascripthtmlframesx-frame-options

How to create a page that cycles through a series of websites every 30 seconds


I'd like to automatically cycle through a series of URLs every 30 seconds. For example, imagine Google.com displays for 30 seconds, then it switches over to Stackoverflow.com for 30 seconds, then on to Zombo.com (Where anything is possible). Perhaps I'll add some sort of cool page transition as well, where the old page slides out or something.

My first attempt was to just create a webpage that has a giant IFRAME that contains the page:

<iframe src="https://www.google.com" style="width: 100%; height: 100%; border: 0px;"></iframe>

Then, I could use script to change the source every 30 seconds. However, it seems modern browsers lock all this stuff down pretty tight. Every URL I've tried gives me the following error:

Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

I think, at least for now, we'll be displaying pages we control but I'd rather not muck with a bunch of code or HTTP server settings if I don't have to.

I suppose I could also create a WPF or Silverlight app that hosts a web browser control, then have total control over the browser.

Are there any simpler options for this sort of app?

Downvoters:

I'm not quite sure why this was considered a bad question. For what it's worth, I completely understand why the X-Frame-Options header exists and the reason for security concerns around hosting IFrames across domains. I'm not looking for ways to counteract legitimate browser security features. I was simply looking for a good method to rotate through a list of websites automatically, and wondering what a good design for this would be.


Solution

  • I'd go with browser plugins, rather than fighting with IFRAMEs.

    Rotisserie URL Rotator

    Revolver Tabs