Languages

Menu
Sites
Language
Is page back possible without TAU library?

Without "TAU lib" back function doesn't work. I don't want use the whole TAU lib because the really strange UI. But I have to use back function.

window.history.back(); not work...

Should I use the "location.replace();" ?? It's not efficient.

back.js is below.

( function () {
    window.addEventListener('tizenhwkey', function( ev ) {
    console.log('뒤로 가기');
        if( ev.keyName === "back" ) {
            var activePopup = document.querySelector( '.ui-popup-active' ),
                page = document.getElementsByClassName( 'ui-page-active' )[0],
                pageid = page ? page.id : "";
            screen.lockOrientation("portrait-primary");
            if( pageid === "mainpageList" && !activePopup) { //로그인화면에서 끄기?
        try {
                tizen.application.getCurrentApplication().exit();
            } catch (ignore) {
            }
            }else {
                window.history.back();
            }
        }
    } );
} () );
 
 

Responses

3 Replies
André Reus

Hi 명훈 심
If you don't want to use the TAU in case of UI design then just ignore TAU tag. Use only the back feature from TAU to meet your back key option! 

명훈 심
Thank you for your answer.
But
When I added "<script src="/lib/tau/mobile/js/tau.js"></script>", the bootstrap's UI was ignored..
 
 
<!DOCTYPE html>
<html>
 
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Black+Han+Sans|Yeon+Sung|Oswald" rel="stylesheet">
<link href="./css/style.css" rel="stylesheet">
<title>Sign In and Sign Up</title>
</head>
 
<body>
<div class="ui-page" id="mainpageList">
<div class="card">
<h1>아령하세요</h1>
<img src="./img/dumbbell.png">
<div class="card-body">
<h5 class="card-title">로그인 또는 회원가입</h5>
<p class="card-text">아이디가 없다면 회원가입을 하세요</p>
<button class="btn btn-primary" id="signIn">로그인</button>
<button class="btn btn-success" id="signUp">회원가입</button>
</div>
<div class="card-footer">
copyright©2018
</div>
</div>
</div><!-- /page one -->
 
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="/lib/tau/mobile/js/tau.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="/js/back.js"></script>
<script src="/js/mainToSignInSignUp.js"></script>
</body>
</html>
K Johnson

Hi 명훈 심,

I'm sharing an implementation concept instead of source code here. How about trying to keep track of the last page everytime you move to a new page? You may keep an ID of the last visited page and on the back key event redirect the user to that page with ID.