Tim Cahill
Tim Cahill

Reputation: 1

Javascript URL redirection if webpage URL link fails

I have recently taken responsibility for a website belonging to a good friend. On one page he has embedded, a rtsp video webcam stream which is received from a Wowza media server (a simple URL address). This works very well indeed.

However occasionally because of local network problems at the webcam location, the stream will fail with a simple black display saying 'media-not-found'.

He has asked me that during these periods of 'media-not-found', could the whole page redirect to another URL?

I've struggled to find a simple solution, so any ideas would be appreciated. The website pages are currently written in a mix of html and javascript.

Upvotes: 0

Views: 84

Answers (1)

Arthur
Arthur

Reputation: 5148

you just have to do

if (err) {
  window.location = 'http://newurl.com'
}

Upvotes: 1

Related Questions