Skip to content

Latest commit

 

History

History
96 lines (63 loc) · 1.83 KB

File metadata and controls

96 lines (63 loc) · 1.83 KB

document/window

remove text from url

// http://localhost/myresume/#image1
document.location.hash = ""
// http://localhost/myresume/#


Open something new window

window.open('img/upwork/jobs/job1.jpg', '_blank', 'location=yes,height=$(window).height(),width=$(window).width(),scrollbars=yes,status=yes');


Get link params from oauth popup window

// https://gist.github.com/CyberT33N/b6077d75d25e1d728d68caeac6914dd4
// https://www.npmjs.com/package/oauth-open
oauthOpen('http://localhost:1337/oauth-dialog.html', async (err, code) => {
   console.log( 'code: ' + JSON.stringify(code, null, 4) );
});
<html>
  <body>

    <div>Authorize OAuth Test App?</div>

    <form action="/code" method="POST">
      <button type="submit">OK</button>
    </form>

  </body>
</html>



/* ---- EXAMPLE #1 ----*/

// Store
localStorage.setItem("lastname", "Smith");
// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");



/* ---- EXAMPLE #2 ----*/
if (localStorage.clickcount) {
  localStorage.clickcount = Number(localStorage.clickcount) + 1;
} else {
  localStorage.clickcount = 1;
}
document.getElementById("result").innerHTML = "You have clicked the button " +
localStorage.clickcount + " time(s).";



Extend/Add url without reload page

// Change url by adding /search?q
window.history.pushState('search', 'search', `/search?q=${searchValue}`);



Get url query paramater

const urlParams = new URLSearchParams(window.location.search);
const myParam = urlParams.get('paramNameHere');