3

Is it impossible to create a browser back button, using a form or link, when a users javascript is disabled?

3
  • 1
    You can find the last url with PHP: (isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "") Commented Apr 6, 2012 at 18:40
  • 3
    Why create a back button when there is one built into the browser? Commented Apr 6, 2012 at 18:41
  • @Chris I may have to do that. Commented Apr 6, 2012 at 19:03

5 Answers 5

5

Without server-side-scripting is not possible.
but you can show a message like this:

1)

<noscript>
    Sorry, I can’t show you that information unless you enable 
        Javascript for your web browser. 
        To go back to where you were, just click/tap your “back” button.

    <style type="text/css">
        #main-content { display:none; }
    </style>
</noscript>

2)
or a page like this:
http://saveyourself.ca/help-no-javascript.php

Sign up to request clarification or add additional context in comments.

Comments

4

The easiest way to do this is on the server side. If you can get the HTTP Referrer (this is available in many server side languages), then you can build a link and append it to the page's regular HTML.

6 Comments

with js disabled, serverside is the ONLY way;)
Only is a strong word. You might be able to do something with a flash or Silverlight implementation, but if it's possible I don't know how.
flash and silverlight are not worth mentioning imo, because this again is a proprietary plugin which easily can be disabled or might not even be installed.
Sure they are. He mentioned when JavaScript is disabled. We have no idea what his circumstances are. It could be that these are viable options, and not mentioning them, means that we are making an assumption as to what is acceptable and what isn't. No I wouldn't do it this way, but he might find one of them the best approach.
fair enough!;) I wouldn't mention because I'm "against" non-standard technologies on the web and pretty much successfully avoided them in my life as web-engineer:-D
|
1

Without server-side-scripting? No. It's not possible.

However, if you're able to run server-side-scripts, then you could save the referrer and create a link yourself (<a href="{REFERRER}">Back</a>). Note that some browser won't send a referrer.

Comments

0

I believe you can't use any javascript commands when it's disabled. However you may still use your browsers back button (not 100% on this since I've never tried it) but if the user has javascript disabled there are many things that won't work on the website. And the big websites usually won't allow users to do much if they don't have javascript enabled. 1 example is storing cookies and whatnot.

However, there are some ways of doing this using PHP.

5 Comments

The back button isn't affected by disabled JavaScript, and you can store and read Cookies via HTTP, you don't need JavaScript for this.
@Zeta sure it is! history.back(); comes from the DOMWindow window.history.back
@micha: I meant the browser's back button, not some custom button ;). window.history.back() won't work of course.
@micha not true! history.back() != browser back button
He's creating a button so he is not taking about the browser back button.
0

A server-side could take HTTP_REFERER and add it dynamically to the current page. But if you know where they will most likely be coming from, you can simulate a back button by putting the most likely return destination there as a link. More

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.