Languages

Menu
Sites
Language
I want when hardware back button is pressed then it display the first page of my application

Hi,

I have developed TIZEN application in which i want to click on hardware back button then it display the first page of my application.

 

please help me as soon as possible.

 

Thanks in advance

 

thanks and regards

Mohit Kumar

 

Responses

5 Replies
Palitsyna

Hi,

may be this code will be usefull for you:

//Initialize function
var init = function () {
    // TODO:: Do your initialization job
    console.log("init() called");

	// add eventListener for tizenhwkey
	document.addEventListener('tizenhwkey', function(e) {
		if(e.keyName == "back") {
            window.location.href='firstPage.html';
		}
	});
};

 

mohit kumar

Hi,

Its work fine.

Thank you

 

 

Mohit Kumar

 

mohit kumar

Hi,

Jquery function to compare background image of button when button click is not working in my application,please help me.

I want to comape background image of button when button click,my code is

*********************************************************

js file

$(document).ready(function() {

    $("#mt1").click(function() {
        if (document.getElementById("mt1").style.backgroundImage === "url('images/cmst1.png')")
            {
            
            alert("hello world");
            }
        
    });

******************************************************

css file

.imghr
{
    background:transparent;    
    background-image:url('images/cmst1.png');

    height:20px;
    width:120px;
    background-repeat: no-repeat;    
    border:none;
    outline:none;
    display:block;
   margin-top:10px;
   text-align:center;
}

**************************************

Html file

<button type="button" id="mt1" class="imghr"></button>

 

*******************************************

my code does not give me what i want,please help me as soon as possible.

 

thanks in advance

Thanks and regards

Mohit Kumar

mohit kumar

Hi,

Jquery function to compare background image of button when button click is not working in my application,please help me.

I want to comape background image of button when button click,my code is

*********************************************************

js file

$(document).ready(function() {

    $("#mt1").click(function() {
        if (document.getElementById("mt1").style.backgroundImage === "url('images/cmst1.png')")
            {
            
            alert("hello world");
            }
        
    });

******************************************************

css file

.imghr
{
    background:transparent;    
    background-image:url('images/cmst1.png');

    height:20px;
    width:120px;
    background-repeat: no-repeat;    
    border:none;
    outline:none;
    display:block;
   margin-top:10px;
   text-align:center;
}

**************************************

Html file

<button type="button" id="mt1" class="imghr"></button>

 

*******************************************

my code does not give me what i want,please help me as soon as possible.

 

thanks in advance

Thanks and regards

Mohit Kumar

Palitsyna

Hi,

you can use following code to get background image URL:

$("#mt1").click(function() {
	var bg = $("#mt1").css('background-image');
	alert(bg);
});

You can also modify it, for example:

	bg = bg.replace('url(','').replace(')','');

This will return URL without     'url()'.

 

Regards,

Svetlana Palitsyna