question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser Back button no working to go to previous question.

See original GitHub issue

Are you requesting a feature, reporting a bug or ask a question?

Ask A question

What is the current behavior?

Browser Back not working to go to previous step

What is the expected behavior?

Wanna use browser back button to go to previous question

How would you reproduce the current behavior (if this is a bug)?

Provide the test code and the tested page URL (if applicable)

Tested page URL:

Test code

your_code_here

Specify your

  • browser:
  • browser version:
  • surveyjs platform (angular or react or jquery or knockout or vue):
  • surveyjs version:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
andrewtelnovcommented, Nov 15, 2017

@robinwkurtz @AhsanShafique Here is the code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Window localition hash - jQuery</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://surveyjs.azureedge.net/0.95.0/survey.jquery.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
</head>
<body>
    <form>
    <div id="surveyElement"></div>
<script>
    Survey.Survey.cssType = "bootstrap";
    Survey.defaultBootstrapCss.navigationButton = "btn btn-green";

    var survey = new Survey.Model({
        pages: [
            { elements: [{type:"text", name: "question1"}, {type:"text", name: "question2"}]},
            { elements: [{type:"text", name: "question3"}, {type:"text", name: "question4"}, {type:"text", name: "question5"}]},
            { elements: [{type:"text", name: "question6"}, {type:"text", name: "question7"}, {type:"text", name: "question8"}, {type:"text", name: "question9"}]},
            { elements: [{type:"text", name: "question10"}, {type:"text", name: "question11"}, {type:"text", name: "question12"}]},
            { elements: [{type:"text", name: "question13"}, {type:"text", name: "question14"}]}
        ]
    });
    survey.onCurrentPageChanged.add(function(survey, options){
        window.location.hash = "page" + (survey.currentPageNo + 1);
    });
    function gotoPageByHash(hash) {
        if(!hash || hash.indexOf("#page") != 0) return;
        hash = hash.replace("#page", "");
        var index = Number.parseInt(hash);
        if(index > 0) {
            index --;
            survey.currentPageNo = index;
        }
    }
    gotoPageByHash(window.location.hash);
    window.onhashchange = function () {
        gotoPageByHash(window.location.hash);
    }    
    $("#surveyElement").Survey({ 
        model: survey 
    });
</script>
</body>
</html>
0reactions
robinwkurtzcommented, Nov 17, 2017

Thanks @andrewtelnov !

Read more comments on GitHub >

github_iconTop Results From Across the Web

FIX: Back Button Not Working in Web Browser?
Another way to deal with the issue is to click the Back button multiple times rapidly. That helps prevent any previous redirects from...
Read more >
Back button it is not taking me to previous page - Stack Overflow
I ran into something similar and it was due to ajax caching being set to true. Try using jQuery ajax instead and set...
Read more >
browser Back Button Problem - MSDN - Microsoft
You basically fix a deficiency in your application by intentionally breaking someone's browser. The back button is part a users browser UI.
Read more >
Back button not working in browsers - Ask Ubuntu
Firefox : navigate to about:config then set browser.backspace_action to 0. Chrome: install the Backspace Shortcuts for Linux extension and setup.
Read more >
Troubleshooting Browser Back Button Not Working
Fix: The Back Button Doesn't Work · 1. Disable your extensions/ add-ons · 2. Clear your cache · 3. Reset or reinstall your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found