Javascript

How do you make a simple script that tells the browser to fo foward or backward?

Thanks
2,646 views 14 replies
Reply #1 Top
Example link that goes back one page:

<a href="javascript:history.go(-1)">back</a>

Example link that goes forward one page:

<a href="javascript:history.go(+1)">forward</a>

Powered by SkinBrowser!
Reply #2 Top
In IE, you use the window.history object (window can be ommited).

This object contains 3 methods:

back() - navigates back one page
forward() - navigates forward one page
go(int) - navigates relative to the current page (negative numbers go backwards, positive numbers go forwards)

Our shop deals with IE only environments, so I'm not sure if this object is supported by other browsers.

Hope this helps.



Powered by SkinBrowser!
Reply #3 Top
dang -- Mike was too quick!!

Powered by SkinBrowser!
Reply #4 Top
Hehe

If you want to make a page does that automatically, copy the bit inside the quotes and add it to your <body> inside the onload="" attribute. Such as:

<body onload="javascript:history.go(-1)">

That would be quite an annoying page to visit, however.

Powered by SkinBrowser!
Reply #6 Top
Hey if anybody knows this is from another forum in which this person needs help:


Norton 2003 Ad Blocker Java Script Screwed?


I've got Norton Internet Security/FireWall and Anti-Virus 2003 installed, with ad and pop-up blocker turned on. I can usually get to real pop-up pages (by real I mean ones I click through links, not ads) but for some reason a lot of sites wont open Javascripted pop up windows. I've turned off ad and pop-up blocking, I've disabled Norton and even completely uninstalled it once, but I still cant open a lot of JS pop-up links! My IE6 is set to allow Javascript, so I dont know what the problem is....

Anyone help?





He has bumped this thread alot of times with nobody helpin him so I thought maybe somebody here would know.
Reply #7 Top
Oh well it was worth a try.
Reply #8 Top
I figured Mike would beat on this one too....

I'm not sure what the problem is. It sure sounds like something is still intercepting/overriding the browser window.open function to supress popups. It really depends on how the norton popup blocker works. Sorry I couldn't help

Powered by SkinBrowser!
Reply #9 Top
ooops----I figured Mike would beat me on this one too....

Powered by SkinBrowser!
Reply #10 Top
Oh no don't worry about it. It was something I threw out there.

He's been bumpin the thread since yesterday so I thought I would try here.
Reply #11 Top
Wonder if he cleared the browser's cache/TIF after he disabled Norton's pop up blocker. (I know that's basic, but some people retain the cache/TIF and don't clear it.) Dunno if that's a factor with NIS, but I know with other pop up blockers, disabling the the blocker, clearing the cache. and just to be sure closing the browser before trying again, usually works if there is a previous restriction on legit pop up windows.
Reply #12 Top
Hey, good thought, Sig. I keep my settings on 'refresh page on every visit', so I rarely have to mess with the cache. Might be worth a try.

Powered by SkinBrowser!
Reply #13 Top
I appreciate that sig and will post it in his thread. Thanks.
Reply #14 Top
Well, I know that with WebWasher and Proxomitron, after disabling them sometimes even refreshing the page alone won't work to clear the previous filtering. Hence my skill at on demand cache clearing and browser closing. Anyway, hope it helps although the poor fellow already went through uninstalling and reinstalling a Norton product.