3

I'm looking for a way to recreate the functionality of a refreshing page extension on a browser (e.g. Auto refresh plus in Chrome) by using javascript. The problem is that I have no ideia how to achieve that. I must find a way to refresh the page every second or so, click on a link that appears on the page from time to time, add a sound effect for when it appears and send an e-mail notification every time it appears.

I'm trying to use a simple javascript snippet to run in the console in order to refresh the page:

win1 = window.open("https://www.myUrl.com/");
timer1 = setInterval(function(){win1.location.href="https://www.myUrl.com/"}, 1500);

However, this implies running code from tab A on tab B which I found very challenging. The code can't run on tab A alone because at the time it refreshes the page, it gets erased from the console. I know it would have been so much easier to use an extension, but the platform I work for does not allowed any extensions. I have basic HTML and javascript knowledge, but I find this would be a good project to learn more. Also, if the solution involves other languages, I just need a direction to know where to look for and start this project.

Konrad
  • 21,590
  • 4
  • 28
  • 64
marcelofw
  • 31
  • 2
  • 2
    Does this answer your question? [Background Scripts vs Content Scripts in Chrome Extensions](https://stackoverflow.com/questions/12971869/background-scripts-vs-content-scripts-in-chrome-extensions) – Konrad Dec 06 '22 at 20:59

0 Answers0