Tag Archive for: Button



There are numerous different ways of disabling the back button or at least messing with the working of the back button so that the browsers cannot go to the previous page. However, fully disabling the browser’s back button is not a good option, plus client-side applications don’t have that many privileges or rights to do so due to security reasons.

In this article, we will implement a simple logic through JavaScript, which stops the browsers from going to the previous page using the window object.

The window.history.forward() Method

In this article, we will stop the habitual working of the back button of the web browser by using the window Object. And to be precise, we will head inside the window object’s history and move it “forward” when the browser tries to revisit the previous page.

Demonstration of Window.history.forward() Method

To start, we need two different HTML pages. The first page is called the home.html, and it contains the following lines:

<center>
      <a href=«secondPage.html»>Click me to visit the next page</a>
</center>

As you can see, we are simply creating an <a> in which we are simply referring to the secondPage.html.

After that, simply create the second HTML with the exact name secondPage.html. And in this HTML document, you want to add the following lines:

<center>
  <b>This is the second page</b>
</center>

This second page only contains text that tells the user that this is the second page. Running the home webpage will give the following result on the browser:

As you can see, clicking the link takes us to the second page, and from the second page, you can press the back button to again come to the home.html

Now in the home.html document, you are going to add in the following script lines inside the script tag:

<script>
      window.history.forward();
</script>

In these lines, we are accessing the history of the browser’s window object and then calling the forward() method to move the browser back to the second page. Thus messing with the habitual flow of the back button of the browser.

Key-point

This script will only work when history has some onward entry to go to. This means that the first-time loading of the webpage will never be affected by this.

After this, simply open the home webpage, click the link to go to the second webpage, and then try clicking the back button of the browser, and you will get the following output:

As you can see, clicking the back button on the browser’s doesn’t take us back to the home.html rather it takes us again on the secondPage.html

Conclusion

To stop the working of the browser’s back button with the help of JavaScript. You can simply call the forward() method on the history of the web browser merienda the webpage has loaded. Now to get access to this history, we must use the window object. This article has demonstrated the working of the window.history.forward() method to stop the working of the back button of the browser.



Source link


The primary way to turn on the laptop is by pressing its power button, however as the laptop ages you might experience that the sensitivity of the button is decreasing. In such a case you have to take preventive measures to avoid being stranded, so there are many ways for turning on your laptop, but this guide explains only the safest and the easiest ones.

Turning on a laptop without power button

There are the following alternate ways to turn on your laptop without using the power button:

  • Turning on the laptop using the lid of the laptop
  • Turning on the laptop using the LAN signal
  • Turning on the laptop on by setting time and date

Turning on the laptop using the lid of the laptop

One of the easiest and quickest ways to turn on the laptop is by using its lid, as you open the lid the laptop is turned on and when you close the lid it will turn off. Moreover, to set the settings of the lid you have to go into bios setting so follow the steps below:

Step1: Restart your laptop and by pressing the F2 key of the keyboard go into the bios settings. Next click on the power option in the list on the left side:

Step 2: Next scroll down to the “Lid Switch” option and turn on the option of “Power on Lid Open” by toggle icon below:

Step 3: Next click on the “APPLY CHANGES” button at the bottom and next click on “EXIT”, now your laptop will turn on as you open the lid:

Step 4: If you want that your laptop shuts down as the lid is closed then go to the advance power settings in the Windows settings:

Next set the option of shutdown for both when charger is plugged in and when on battery and save the changes:

Turning on the laptop using the LAN signal

There is another method to turn on and that is by connecting the LAN cable to your laptop and this setting can be turned on by going into bios settings of your laptop so follow the given steps:

Step 1: Restart your laptop and press f2 key from the keyboard to go to the bios settings and merienda you have got into the bios settings click on the “System Management” option from the list on the left:

Step 2: Scroll down the system management menu to “Wake on LAN” and click on the second option that is “LAN Only”:

Step 3: Next click on the “APPLY CHANGES” button at the bottom and next click on “EXIT”, now your laptop will turn on as you plug in the LAN cable:

Turning on the laptop by setting time and date

If you use your laptop for a limited number of hours like during your work hours there is an option of setting time and day at which the laptop will automatically turn on. To active such option you have to go the Windows bios settings, so assign time and day to your laptop to turn on following the steps below:

Step1: Restart your laptop and by pressing the F2 key of the keyboard go into the bios settings. Next click on the “System Management” option in the list on the left side:

Step 2: Scroll down the “System Management” menu to “Coche on Time” option and set the time and days of the week on which you want to use your laptop:

Step 3: Merienda you have selected the suitable options then click on “APPLY CHANGES” button at the bottom and next click on “EXIT”, now your laptop will turn on at the time and day you selected.

Note: Consult your user manual before going to BIOS settings as the key used to go into the bios settings may vary from laptop to laptop. For demonstration I have displayed the bios settings of a DELL laptop, so you might find a difference in GUI and settings menu of bios settings of any other manufacturer of laptop.

Conclusion

If your power button is starting to wear out and you are worried that it might stop working at any time, then there are a number of solutions for it. This guide has explained the three safe alternate ways to turn on your laptop without the power button though there are a lot of methods one can find on the internet but not all are safe.



Source link


“Align Button Right means that we set the button to the right side of the page. Alignment is something about the adjustment of the text or button at different positions. It describes the position of our text and buttons, whether we want to align our text or button to the right of the page or the left or center. In CSS, as we can align our text like this, we can align buttons to the left, right, and center of the page using different properties. CSS provides different properties for the alignment of the buttons. We can align the buttons where we want. In this tutorial, we will explain all about the right alignment of our button using alternative properties in CSS. We provide different codes in which we use alternative properties to align a button to the right.”

Properties for Align Right Button in CSS

  • Using text-align property.
  • Using float property.
  • Using justify-content property.

Example # 1: Align Button Right Using the Text-Align Property

Create your HTML file for creating the button, and for aligning this button, we have to create the CSS. We are going to elaborate on the given examples in our visual code studio. So, we have to generate the HTML file, and the code of this HTML file is pasted below in the image.

Here, we have created two different buttons and then want to align one button to the right so you can easily learn the difference between the innovador button and the right align button. So, for this alignment of buttons, we have to utilize the CSS text-align property. When we use this property on the button which we have created, then the button sets its position to the right side of the page. In the CSS file, you can see how to use this property.

CSS Code

Here, the CSS code is also given below. We use CSS to give style or giving alignment to our buttons. In this code, you can see that we are using the “text-align” property.

First, we use the “.” and the name of our first button, which is “btn-original” here, and inside the curly braces of this first button, we use the “text-align” property and set it to the “left.” We write the title of the second button, which is “btn-right,” by putting. “” again and inside the curly braces, we again use the same property, and this time we align the button to the “right” side of the page or screen.

Output:

The output shows two buttons in which the innovador button is displayed on the left side, and then the button is shifted to the right side of the screen.

Example # 2: Align Button Right Using the Float Property

In this HTML file, we again design two buttons. The name of the first button is “Button” here, and the name of the second button is “Right Button.” In this example, we are going to use another property for aligning the button to the right. The property we use in the CSS of this code is the “float” property. It works the same as the “text-align” property does.

CSS Code

In this CSS file, we use the float property. The float property in CSS is used for floating the element or object or button to the right and left sides. The “.innovador” is used for applying design to the “innovador” button. Inside this, we apply the “float” property and set it to the “left,” so the innovador button is placed on the left corner of the screen. Inside the “.right” button, we set the “right” to the “float” property. This will place our second button on the right corner of the screen.

Output

In the above image, the button is aligned to the right corner of the screen. Here, we have used the “float” property, and you can see it displays the output the same as the “text-align” property showed.

Example # 3: Align Button Right Using the Justify-Content Property

In the third example, we create only one button using the div class and then use the third property of CSS, which is the “justify-content” property. This property also aligns the button to the left or right, but we have to align the button only to the right

CSS Code

In this CSS file, we also change the “background” color to “pink” and set the “padding” to “10px” from top and bottom and “0” for the right and left. The “display” we use here is “flex,” and then use the third property of CSS that is “justify-content” and set it to “flex-end,” so this “flex-end” sets the button to the right end.

Output

The background color is pink here, as we use “background-color” to “pink.” The button is at the right end as we use the “justify-content” property in our CSS file of this example.

Example # 4

In this fourth example, we have created six different buttons using the button class in HTML. Now, we use different colors for all six buttons and align three buttons to the “right” using CSS property, and three are on the innovador place, which is “left,” where we don’t use any property.

CSS Code

The color of the first button is “green,” and the code for this is “#4CAF50”. We don’t need any border, so the border is “none.” The “color” of the text written inside these buttons is “white.” The top and bottom paddings are “15px,” and the left and right paddings are “32px”. The “text-align” is centered, so the text inside the button appears in the center of the button. The “text-decoration” is also “none.” The “font-size” is set to “16px”. The top and bottom margins are “4px,” and the right and left margins are “2px”. The “pointer” is here to be used as a “cursor.”

Then we align this button to the right, so we have the “float” here, which is set to the “right.” Also, change the color of the next button and apply “red” here, and don’t use any property for aligning the button, so by default, this button will display on the left side. The fourth button, “background-color,” is white, so we also change the “color” of the text to “black” and float this fourth button to the right. After changing the color of the fifth and sixth buttons to hermandad, we again use “float: right” with the sixth button. Let’s check how it will show these buttons on the browser.

Output

In this output, we have six buttons in which three buttons are rendered on the right side where we use the property “float.” So, with the help of this property, three buttons float to the right side. And also, three buttons are on the left side, as we didn’t use any property for these three buttons. The colors of these buttons are also different.

Conclusion

This tutorial has discussed the three properties which the CSS provides for aligning the button to the right corner of the screen. We have explained all three properties of CSS in detail which are “text-align,” “float,” and “justify-content” properties. We have generated three different examples, and we have applied the alternative properties in each example and displayed the output of all the codes also, so you can easily get this point about how to align the button to the right. This tutorial will help you to align your button to the right side using the properties of CSS.



Source link