/    Sign up×
Community /Pin to ProfileBookmark

window not redirecting correctly in Seamonkey

I can’t get the window to redirect to the correct page in Seamonkey. It works fine in Firefox and IE.

Here is a simple version of what I have:

[CODE]
//html code…
<body onunload=”myFunction()”>
//html code…

function myFunction() {
var test = “www.mysite.com/here/there/everywhere”;
window.top.location.href = test;
}[/CODE]

window.top.location.href doesn’t seem to be working correctly because it goes to “www.mysite.com” instead of “www.mysite.com/here/there/everywhere”

I’ve tried returning “false” and returning the url like “onunload=’window.top.location.href=myFunction()'”
Neither worked.

Any ideas?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@TheTeenScripterJan 08.2009 — did you try adding http:// to the front of it?? just a suggestion... also, try the location.replace() function.. who knows it might work, stranger things have happened
Copy linkTweet thisAlerts:
@ss1289authorJan 08.2009 — Thanks for the reply but neither worked.

Once it gets to "window.top.location.href" is it suppose to keep executing any code after that? Because it is.
Copy linkTweet thisAlerts:
@TheTeenScripterJan 08.2009 — try messaging the tech support team of seamonkey, they would probably be able to help you out better, i would think...
Copy linkTweet thisAlerts:
@toicontienJan 08.2009 — Seamonkey is probably blocking this behavior, as it might be viewed as hijacking the browser away from user control. What if the user types "www.google.com" in their address bar on your page? They want to go to Google, but you're not going to allow them? What if you are redirecting people to a malware site? Because of this, Seamonkey is probably blocking that from ever happening because you are trying to redirect the user when the user has chosen to leave the page -- meaning they already have a destination in mind and you are not allowing them to get there.
×

Success!

Help @ss1289 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...