Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

304
Visualizações
How to allow my Product1 users to bookmark my Product2 link from Product1 web page?

I am trying to allow my user to bookmark my external product link by clicking on the button but getting a problem with window.sidebar.addPanel and window.external.AddFavorite as both are not supported now.

I have a PHP application and looking for the best suitable solutions here.

I am getting

Uncaught TypeError: window.sidebar.addPanel is not a function

error with following code.

<head>
  <script type="text/javascript">
    function AddToBookmark() {
      if (window.sidebar) { // Firefox
        window.sidebar.addPanel('Dottoro help page', 'http://help.dottoro.com', '');
      } else {
        if (window.external && ('AddFavorite' in window.external)) {
          // Internet Explorer
          window.external.AddFavorite('http://help.dottoro.com', 'Dottoro help page');
        } else { // Opera, Google Chrome and Safari
          alert("Your browser doesn't support this example!");
        }
      }
    }
  </script>
</head>

<body>
  <button onclick="AddToBookmark();">Add to Bookmark</button>
</body>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

According to this answer

addPanel was removed from Firefox since v. 23. But you can use markup instead:

<a href="http://stackoverflow.com" title="Stack Overflow" rel="sidebar">Bookmark me</a>

Hence you can simulate a click on a similar <a> tag in your AddToBookmark() function as below.

const anchorTag = document.createElement('a');
anchorTag.href = "http://help.dottoro.com"
anchorTag.title= "Dottoro help page";
anchorTag.rel= "sidebar";
anchorTag.click();

<body>

  <button onclick="AddToBookmark();">Add to Bookmark</button>

  <script type="text/javascript">
    function AddToBookmark() {
      if (window.sidebar) { // Firefox
        const anchorTag = document.createElement('a');
        anchorTag.href = "http://help.dottoro.com"
        anchorTag.title = "Dottoro help page";
        anchorTag.rel = "sidebar";
        anchorTag.click();
      } else {
        if (window.external && ('AddFavorite' in window.external)) {
          // Internet Explorer
          window.external.AddFavorite('http://help.dottoro.com', 'Dottoro help page');
        } else { // Opera, Google Chrome and Safari
          alert("Your browser doesn't support this example!");
        }
      }
    }
  </script>
</body>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda