IE creates a 404 in JavaScript redirect
Posted: Sat Dec 08, 2007 6:03 am
feyd | Please use
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This script works in conjunction with Hi-Fi and Lo-Fi links (onclick event attributes). It determines if the visitor is in the frame or not, loads the frame, loads the song requested in the music frame, and loads the playlist page they clicked the link on in to the main content frame.
The issue is Internet Explorer. So I came across a 404 in my access log and saw the referrer, checked it out, and determine it was IE because everything else plays nicely. IE mishandles the script and redirects the visitor too...
/music/home/?track=2.1-07.php&audio=2&playlist=2.1.php
There is no home directory in the music directory, they are both parent directories in my account's root. I have no idea how to scan and remove 'music/' out of location.href...sounds like regex and I stink at regex...if that is what I need?
[syntax="javascript"]var thisurl = self.location;
function mplayer(playlist, track)
{
if (top.location == self.location)
{
//alert (thisurl);
location.href = 'home/?' + 'track=' + track + '&playlist=' + playlist;
//
}
}feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]