/    Sign up×
Community /Pin to ProfileBookmark

Browser History Manipulation

I have a web page which is created by a cgi script written in perl. This page contains many javascript jump menus using the code provided with Dreamweaver:

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+”.location='”+selObj.options[selObj.selectedIndex].value+”‘”);
if (restore) selObj.selectedIndex=0;
}

Each of these jump menus calls the script again with a different code:

<select name=”110″ onChange=”MM_jumpMenu(‘parent’,this,0)”>
<option value=”page.cgi?code=37026588OS163903639T”>Change This</option>
<option value=”page.cgi?code=7T0629158L5G080AA961″>Change That</option>
<option value=”page.cgi?code=36QJMU43508S03077022″>Change Another Thing</option>
<option value=”page.cgi?code=0R248L1C010200587958″>Change Something Else</option>
</select>

The code contains instructions on changes to be made to the page. The script makes those changes then outputs the revision. This loop can happen over and over. The script works just fine; my problem is that each time the page is diplayed, it is added to the browser’s history. I really need each instance of the page to replace the previous instance. Any help would be sincerely appreciated.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@joharranauthorFeb 17.2009 — Thanks, Fang. I understand in principle what replace() does, but I am a javascript noob and need a little more assistance.

I had hoped for a way to simply remove (rather than replace) the last entry in a browser's history. Is this possible?

If not, I need some help rewriting the script to accept a return value from the perl script and then calling replace() with it.
Copy linkTweet thisAlerts:
@slaughtersFeb 17.2009 — You can't remove you can only prevent a page from being placed in a history list. Here are a couple of ways of using it: http://stansight.com/WordPress/2007/10/15/replacing-history/

For your code changing

eval(targ+".location[COLOR="Red"][B]=[/B][/COLOR]'"+selObj.options[selObj.selectedIndex].value+"'");

to

eval(targ+".location[COLOR="red"][B].replace([/B][/COLOR]'"+selObj.options[selObj.selectedIndex].value+"'[COLOR="Red"][B])[/B][/COLOR]");

might work. If not then go into the "page.cgi" program and change the way it navigates back to your menu to use location.replace
Copy linkTweet thisAlerts:
@joharranauthorFeb 17.2009 — This works beautifully! You've made my day. Thanks!
×

Success!

Help @joharran 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.21,
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,
)...