473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

need back script for safari

i'm looking for a back script that will work in Safari (on mac).
the one below works fine in IE and netscape but not safari.

<a href="#" onClick="history.go(-1)">go back</a>

any help plz?
Jul 23 '05 #1
3 9126
In article
<no*******************@c211-28-190-157.mckinn1.vic.optusnet.com.au>,
woodsie <no**@none.com> wrote:
i'm looking for a back script that will work in Safari (on mac).
the one below works fine in IE and netscape but not safari.

<a href="#" onClick="history.go(-1)">go back</a>

any help plz?


use history.back() instead of history.go(-1)
Jul 23 '05 #2
woodsie wrote:
*i'm looking for a back script that will work in Safari (on mac).
the one below works fine in IE and netscape but not safari.

<a href="#" onClick="history.go(-1)">go back</a>

any help plz? *


You can use history.go(-1), but don't use the "#" and the "onClick
command:

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

This works in Safari
-
dBrippe

Jul 23 '05 #3
dBrippel <dB*************@mail.forum4designers.com> writes:
woodsie wrote:
<a href="#" onClick="history.go(-1)">go back</a>
.... You can use history.go(-1), but don't use the "#" and the "onClick"
command:

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


I disagree. You only need to use "javascript:" when you are creating
bookmarklets. In all other cases, you should use onclick instead.
<URL: http://jibbering.com/faq/#FAQ4_24 >

I don't know what the problem with Safari is, but I won't believe
that it's onclick handlers not working. Try:
<a href="..." onClick="history.go(-1);return false;">go back</a>

Now, the big question is what to write instead of "...".

I agree that "#" and "" are not good solutions (both link back to
the same page, which is not a good behavior for a link that says
"go back").

Since the href is only used if Javascript fails, you cannot use
Javascript to fill it out.
Either 1) use server side scripting to make it link to the previous
page based on the referrer header, if present, 2) make it link to
a plausible previosu page, or 3) make it link to a page that tells
the user that he needs Javascript.

A different solution is to only include the link if Javascript is
enabled, either by creating it using Javascript, or by hiding it
using CSS and unhide it using Javascript.
Anyway, I think it is a bad idea to reimplement basic browser
interface functions. There is already a back button, and it works
100% of the time.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Maik | last post by:
I Need a popup-killer script
1
by: bin_P19 P | last post by:
the code i have got is as follows and now im stuck <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Shopping...
4
by: MPennig | last post by:
Here's my situation. I have a function defined in my document's <head> section which adds a <script> tag to a specified <div> tag. The added <script> has a src="" attribute pointing to a PHP file,...
13
by: elektrophyte | last post by:
I've got a short script that works fine in I.E. and Firefox, but not in Safari. It is supposed to print a constantly-updating counter on the webpage. Any ideas how to get it to work in Safari? The...
28
by: Randy Starkey | last post by:
Hi, Does anyone know where I can get a script that show a little plus sign after a line of text, that when you click the plus sign, more text is revealed on that same page, like a continuing...
1
by: DarthOptimus | last post by:
Hi, There is javascript code on my jsp to prevent double submission of a form: <SCRIPT type="text/javascript" language="JavaScript"> var firstSubmit = true; function isFirstSubmit() {
13
by: Ralph | last post by:
Hi Is it possible to trigger the certain event from JS function? I have an image with on click event handler assigned. Now if like to trigger this event for this image from some other...
9
by: whitgurley | last post by:
I've searched the web as well as I can for a solution to this problem but have found nothing and just don't know enough about JavaScript to figure out what's going. What I'm trying to do is convert...
3
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
In the page_load event i need to see which event fired the post back. what here allows this. I specificly want to know if the enter key was pressed. but i need to check for others. -- (i''ll be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.