Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
stop open() page refreshing
Old 03-22-2006, 12:47 PM stop open() page refreshing
Guerrilla's Avatar
Ultra Talker

Posts: 424
Trades: -1
Hi,

I have create a pop up to contain my flash player, only problem is that when people navigate my site (dynamic content) the window keeps getting refreshed. I tried the below code but can gte it to help. Just re-read the whole window object chapter of my JS book and still no idea how to do it.

Please help!

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
if (!music){
var music = window.open("player.htm","musicWin","width=500,height=400");
}
</script>
</head>

<body>
</body>
</html>
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-22-2006, 04:28 PM Re: stop open() page refreshing
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I think the problem is that the music variable won't get passed on refresh. I'm not sure if this will work, but you might try creating an html form that just has one hidden input that you would set. The form would use the page itself as the action and then you should be able to reference that variable on refreshing the page. I think you'll need a server side scripting language to reference the variable.

You'll also need to set up some javascript so the form is automatically submitted on refreshing the page.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-22-2006, 05:28 PM Re: stop open() page refreshing
kline11's Avatar
SearchBliss Web Tools

Posts: 1,726
Name: John
Location: USA
Trades: 0
Are you saying that the window player.htm keeps getting refreshed? You could try adding
onUnload="window.stop()" in the body tag of the page reloading. This might work.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
kline11 is offline
Reply With Quote
View Public Profile
 
Old 03-24-2006, 02:12 AM Re: stop open() page refreshing
Super Talker

Posts: 144
Trades: 0
the music variable won't be present on refresh, as vangogh suggested, however, if the window is open, you should have access to it via the window name.

var musicWin = null;

function open_musicWin() {
if (!musicWin || musicWin.closed)
musicWin = window.open("about:blank", "musicWin");

musicWin.location.href = "http://www.yahoo.com";

musicWin.focus();
}

open_musicWin();
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-24-2006, 06:34 PM Re: stop open() page refreshing
Guerrilla's Avatar
Ultra Talker

Posts: 424
Trades: -1
Thanks for the suggestions, the only way i can figure out how to do it is use a cookie and to disable the player for those without cookies.

Thanks for the code createvibe.com but it gave exactly the same problem, when the main window is refreshed the opened window (playing the music) also gets refreshed and music starts from beginning.

Nothings ever simple...!
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
Old 03-24-2006, 06:43 PM Re: stop open() page refreshing
Super Talker

Posts: 144
Trades: 0
if that's the case, then just don't change the location.href if the window is already open.

Code:
var musicWin = null;

function open_musicWin(url) {
  if (!musicWin || musicWin.closed)
    musicWin = window.open(url, "musicWin");
  else if (musicWin.location.href != url)
    musicWin.location.href = url;
 
  musicWin.focus();
}

open_musicWin();
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-24-2006, 06:43 PM Re: stop open() page refreshing
Super Talker

Posts: 144
Trades: 0
doh,

open_musicWin("http://www.yahoo.com");

__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-27-2006, 06:35 PM Re: stop open() page refreshing
Guerrilla's Avatar
Ultra Talker

Posts: 424
Trades: -1
it still refreshes the player window
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
Old 03-27-2006, 07:07 PM Re: stop open() page refreshing
Super Talker

Posts: 144
Trades: 0
huh? d0od show me the URI that you need opened in the popup and i'll use that with the example
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-28-2006, 05:58 PM Re: stop open() page refreshing
Guerrilla's Avatar
Ultra Talker

Posts: 424
Trades: -1
http://www.russianrouletteband.com/mp3/player.swf or http://www.russianrouletteband.com/mp3/player.html

refresh the parent window, it re-executes the code and the player window reloads making the track start from the beginning again.

Im using mozilla BTW
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
Old 03-28-2006, 06:26 PM Re: stop open() page refreshing
Super Talker

Posts: 144
Trades: 0
well, it must be as vangogh said. though the window target will be available, you won't have a reference to that window, so you won't be able to control it once the page refreshes.
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-29-2006, 04:54 AM Re: stop open() page refreshing
Guerrilla's Avatar
Ultra Talker

Posts: 424
Trades: -1
yer, only way I can see is to use a cookie which sux0r
__________________
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
Guerrilla is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to stop open() page refreshing
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37122 seconds with 12 queries