iphone - Can I check if there is a next page in browser history w/Javascript? -
here quick description: i'm using iwebkit display webpage full screen iphone app. when this, gain real estate, lose navigation buttons. can put buttons act forward/back on page , recapture capability. desirable, can put other content on same line buttons (like "home" button, , title)
i'd able control display of these javascript-powered forward , buttons, depending on whether there next or previous page go to. example, if there no next page, next button can grayed out , not clickable. if cannot control how buttons displayed, clickable have no effect. may lead user-confusion.
in conclusion, want know if there data can accessed tell me whether there next page in history. and, matter, previous page. reading, history.next
hidden security reasons. history.forward()
, history.go(1)
seem useful ways transition pages, not check see if pages exist. history.length(
) tells how many pages in history, afaik can't figure in queue.
is there way check whether there next/previous page in browser history?
oddly enough, though understand there huge security issue if possible @ browser history, (easily) managed list current history in firefox 4b9:
var i, h = window.history, o = document.getelementbyid("output"); o.innerhtml = "<b>" + window.location.href + "<\/b><br>"; (i = 0; < h.length; i++) o.innerhtml += h[i] + "<br>";
with list, can check whether or not last and/or first item correspond window.location.href
(of properties history.current
protected :=s). if corresponds 1 of them, might @ beginning or end of list (but might @ same address somewhere in middle of list); if not, you're not @ edges of history.
and bad news: want apply webkit-based browser, tested above code in chromium, array-like items of window.history
not there.
Comments
Post a Comment