Closed
Bug 168150
Opened 22 years ago
Closed 3 years ago
history.go(location) isn't implemented
Categories
(Core :: DOM: Core & HTML, defect, P5)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: cheffe, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1) Gecko/20020826 Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1) Gecko/20020826 Three example files were needed: --- test1.htm ------------------------------------------- <head> <title></title> <script language="JavaScript1.2"><!-- var Stack = new Array(); var StackPos = 0; alert("test1.htm set up"); function Mark() { Stack[StackPos++] = hugo.location.href; } function Rosie() { hugo.history.go(Stack[--StackPos]); //#WORKS# hugo.location = Stack[--StackPos]; } //--></script> </head> <frameset ROWS="100%,*" BORDER="0" FRAMEBORDER="0"> <FRAME SRC="./test2.htm" SCROLLING="AUTO" NORESIZE Name=hugo> </FRAMESET> <noframes> <b>This is file test1.htm - please turn on your frame support!</b> </noframes> </html> --- EOF ------------------------------------------------- --- test2.htm ------------------------------------------- <html> <head> <title></title> <script> parent.Mark(); </script> </head> <b> This is file test2.htm - Please hit <a href="./test3.htm">here</a> to load test3.htm... </b> </html> --- EOF ------------------------------------------------- --- test3.htm ------------------------------------------- <html> <head> <title></title> </head> <b> This is file test3.htm - Please hit <a href="javascript:parent.Rosie();">here</a> to return to test2.htm... </b> </html> --- EOF ------------------------------------------------- With this construction, I should be able to switch between test2 und test3. Under NetScape 4.75 everything works fine, but Mozilla has probs. I've added a #WORKS# comment which shows, how I can get it working, but the problem with that solution is, that the history buffer is filled up with mess (which I don't want to happen). Any suggestions? Reproducible: Always Steps to Reproduce: See description Actual Results: I can't switch back to an previously loaded frame. Expected Results: Load the frame from the history and clean up the history buffer
Updated•22 years ago
|
Summary: history.go() doesn't work → history.go() doesn't work
Comment 1•22 years ago
|
||
Browser, not engine ---> History: Session
Assignee: rogerl → radha
Component: JavaScript Engine → History: Session
QA Contact: pschwartau → claudius
Comment 2•22 years ago
|
||
reporter (Jam): can you reproduce this bug with a recent build of mozilla (for example, 1.2.1)? if so, please comment again with details (attaching a testcase to the bug would make it easy to see how this works). if not, please resolve this bug as WORKSFORME. thanks.
I tested it with 1.2.1. If you copy the text between the "-----" into the the given files names (in the same directory) and loads test1.htm into the browser, then you'll see 1. a popup-window appearing and informing, that test1.htm is set up (javascript) proberly 2. see a text which informs, that test2.is currently active and you can hit the link to go to test3.htm 3. then you'll get a message from test3.htm with a link to go back to test2.htm 4. hitting the link should reload test2.htm (so you can switch forth and back between test2.htm and test3.htm). this works e.g. with netscape 4.xx but not with any modzilla version. Hope that helps Jam
Comment 4•21 years ago
|
||
history.go() is a function that takes a _number_ to go to in session history, relative to the current page. E.g. history.go(-1) to go back one page. So what you're doing is in fact not supposed to work; I wonder why you decided that it should...
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
go Loads a URL from the history list. Method of History Implemented in JavaScript 1.0 Syntax go(delta) go(location) Parameters delta An integer representing a relative position in the history list. location A string representing all or part of a URL in the history list. Description The go method navigates to the location in the history list determined by the specified parameter. If the delta argument is 0, the browser reloads the current page. If it is an integer greater than 0, the go method loads the URL that is that number of entries forward in the history list; otherwise, it loads the URL that is that number of entries backward in the history list. The location argument is a string. Use location to load the nearest history entry whose URL contains location as a substring. Matching the URL to the location parameter is case-insensitive. Each section of a URL contains different information. See Location for a description of the URL components. The go method creates a new entry in the history list. To load a URL without creating an entry in the history list, use Location.replace. Examples The following button navigates to the nearest history entry that contains the string "home.netscape.com": <P><INPUT TYPE="button" VALUE="Go" onClick="history.go('home.netscape.com')"> The following button navigates to the URL that is three entries backward in the history list: <P><INPUT TYPE="button" VALUE="Go" onClick="history.go(-3)"> See also History.back, History.forward, Location.reload, Location.replace
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Summary: history.go() doesn't work → history.go(location) isn't implemented
Comment 6•21 years ago
|
||
Aiee. Punting over to DOM, I guess, to decide whether we want to support that....
Assignee: radha → general
Status: UNCONFIRMED → NEW
Component: History: Session → DOM: Level 0
Ever confirmed: true
OS: Windows NT → All
QA Contact: claudius → ian
Hardware: PC → All
Comment 7•20 years ago
|
||
Bummer this is here. I ran into the need for this badly today (using Moz 1.6). It is part of the JS 1.1 standard, at least according to my O'Reilly JS book; so I don't understand the comment "Punting over to DOM, I guess, to decide whether we want to support that". I suppose I'm assuming standard compliance is good, but isn't the only decision "when" or "what priority"? Pretending that I can carve out time for this, can someone point me to the proper directory where the history object code would be found? (or at least get me close :-)
Comment 8•20 years ago
|
||
Actaully, the Window object is not part of any standard... and JS 1.1 is not a standard, just a version of a language (of which Window is NOT a part). For anyone who feels like working on this, what would need to happen is that http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsHistory.cpp#243 (HistoryImpl::Go()) would need to detect a string argument in addition to the numeric one it detects now and it would need to call LoadURI on the webnavigation object the way HistoryImpl::Go(PRInt32 aDelta) does. Then nsSHistory::LoadURI would need to be implemented in some way at http://lxr.mozilla.org/seamonkey/source/xpfe/components/shistory/src/nsSHistory.cpp#635 (and deal with frames somehow... great fun).
Comment 9•20 years ago
|
||
I have an exit script which works in Netscape 7, IE6, which returns the user back to the original login page. <script> var loc1 = location.href; var endp = loc1.search(/logout/gi); var loc2 = loc1.substr(0,endp) + "index.asp" ; history.go(loc2) </script> renders the equivalent of history.go("http://10.1.1.1/index.asp") Have a new customer who wants to use FireFox as their default browser. My exit script won't work for him. Otherwise, everything else works great.
Comment 10•20 years ago
|
||
(In reply to comment #9) > I have an exit script which works in Netscape 7, IE6, which returns the user > back to the original login page. > > <script> > var loc1 = location.href; > var endp = loc1.search(/logout/gi); > var loc2 = loc1.substr(0,endp) + "index.asp" ; > history.go(loc2) > </script> > > renders the equivalent of history.go("http://10.1.1.1/index.asp") > Have a new customer who wants to use FireFox as their default browser. My exit > script won't work for him. Otherwise, everything else works great. > > > If you are using ASP your could try this: onClick="window.location='<%=Request.ServerVariables("HTTP_REFERER")%>'"
Comment 11•20 years ago
|
||
*** Bug 273655 has been marked as a duplicate of this bug. ***
Comment 12•20 years ago
|
||
*** Bug 275455 has been marked as a duplicate of this bug. ***
Comment 13•20 years ago
|
||
Wouldn't doing this leak history a tiny bit? In IE, window.history.go('http://www.mozilla.org/'); window.setTimeout("alert('clean')",2000); tells you whether someone has been traitorous in that session (assuming, of course, that instead of an alert it's an XMLHttpRequest resending a login cookie to identify who hasn't been bad).
Comment 14•20 years ago
|
||
*** Bug 279119 has been marked as a duplicate of this bug. ***
(In reply to comment #13) > Wouldn't doing this leak history a tiny bit? Yeah, that was my first thought too. Though admittedly I was searching for a reason not to implement this :) In any case, there doesn't seem to be a whole lot of sites out there that use this. Regarding comment 10: You could simply do window.location = loc2;
Updated•15 years ago
|
Assignee: general → nobody
QA Contact: ian → general
Comment 16•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Comment 17•3 years ago
|
||
This didn't make it into the HTML Standard and from the comments above that seems like a good thing.
Status: NEW → RESOLVED
Closed: 21 years ago → 3 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•