...

View Full Version : embedded swf & browser history



ignatius
01-19-2005, 06:21 PM
Does anyone know the affect that playing a swf file has on browser history?

I need to play swf file - but it's messing up my navigation. I'm building a web-based training course and navigation is limited to previous/next. The Previous link works with javascript's window.history(-1).

All I want to do is play a swf file without screwing up the previous button. However, I do not want to use a second window - it all needs to remain within the window already open. Below I describe 3 scenarios that I already tried and which do not work properly:

The first thing I tried was giving the swf it's own page. It went like this:
On page 10 the user clicks a button which sends them to page X where a swf file played. The last slide of the swf executed a javascript command to send the user back to page 10. Back on page 10, if the user clicks the previous button it takes them to page 9. However, if the user clicks the previous button now on page 9, it takes them back to page 10. And this keeps repeating - making it impossible to return to page 8.

Next I tried what I do in other situations where users need to go to a page X (but without swf files) is to use javascript's window.location.replace('filename.htm'). And this prevents the previous button from going wacky.

The scenario goes like this:
On page 10, a user clicks a button that uses location.replace to send them to page X. On page X, location.replace is used in the embed tag to open the swf file. On the last slide of the swf, location.replace is used to send user back to page 10. So then on page 10, the previous button returns to page 9 and then page 9's previous returns to page 10 and there is another loop between 9 and 10.

The last thing I tried (and which I'm currently using) is getting rid of page X altogether and using a hidden div tag on page 10 for the embedded swf code. When the user clicks the button on page 10, the div tag turns visible and the swf is set to play. The last slide of the swf file uses location.replace to return to page 10 (which somehow makes the div tag invisible again). Now page 10's previous button goes to page 10, and then to page 9 BUT with no loop. In other words, the user needs to click previous twice to get back to page 9, but is then able to navigate backwards/forwards as usual.

Willy Duitt
01-20-2005, 12:51 AM
The last thing I tried (and which I'm currently using) is getting rid of page X altogether and using a hidden div tag on page 10 for the embedded swf code. When the user clicks the button on page 10, the div tag turns visible and the swf is set to play. The last slide of the swf file uses location.replace to return to page 10 (which somehow makes the div tag invisible again). Now page 10's previous button goes to page 10, and then to page 9 BUT with no loop. In other words, the user needs to click previous twice to get back to page 9, but is then able to navigate backwards/forwards as usual.

You could try: history.go(-1);
Rather than: location.replace('page.10');

This should bring you back to page 10 with page 9 on bat in the previous history...

.....Willy

ignatius
01-20-2005, 03:19 PM
i tried your suggestion, but it didn't work. the swf file ended and didn't return to page 10. from other testing i've done, i think the swf file doesn't detect any other history, so it can't go back one page because there's nothing there. but the browser window still detects the history and records the swf in it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum