/    Sign up×
Community /Pin to ProfileBookmark

Another IE8 problem – onclick

I have used the following pre-deletion confirmation code on my sites for ages.

[CODE]<input type=”button” class=”btn” value=”Clear Order” onclick=”if (confirm(‘Delete Order?’)) {location.href=’somepage.php’;}”/> [/CODE]

Just recently it appears that some IE8 browsers are essentially ignoring the conditional check and charging on to the target link rergardless!

There seems to be considerable chatter on the forums about IE8 javascript handling but nothing definitive on this common piece of code.

Any clues?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJun 11.2010 — I never heard of it, and I can't duplicate it.

I don't use inline code, but I put it on a page to test in IE8.

It navigates to the href url when you confirm 'OK' and does not when you click 'cancel', as you would expect.

I tested on a localhost server, so pages run with the http: protocol and not file:c, if that makes a difference.
Copy linkTweet thisAlerts:
@philsphilesauthorJun 11.2010 — Thanks for the reply - I should have been more explicit.

I too can't replicate the error but it has happened to at least 2 other clients and the only apparent common denominator of any significance I can find is they are on IE8 (javascript enable!).

My research into the issue suggests IE8 is exhibiting various behavioural differences from past versions and a couple of posts on other forums describe similar prtoblems but with no solutions being offered yet - ergo my assumption that this is likely an IE8 scenario.

Could it be a mix of other browser settings preventing the usual behaviour of the code?

Any other comments would be appreciated.
×

Success!

Help @philsphiles 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.19,
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,
)...