amazon review button JavaScript

Add Review Button to Amazon with JavaScript

I wrote JavaScript to add a review button to Amazon. I wrote it for now, but Amazon URLs seem to have many variations like dp or gp, so it's incomplete. I'll edit it when I feel like it.

Shou Arisaka
1 min read
Oct 25, 2025

I wrote JavaScript to add a review button to Amazon.

I wrote it for now, but Amazon URLs seem to have many variations like dp or gp, so itโ€™s incomplete. Iโ€™ll edit it when I feel like it.

Source code


function addCSS(code){
  var css = document.createElement("style");
  css.type = "text/css";
  css.innerHTML = code;
  document.body.appendChild(css);
}

addCSS('.reviewLink {color: #0066c0 ; font-size: 13px ; }')

var span = document.createElement("span");
span.innerText = "ใƒฌใƒ“ใƒฅใƒผใ™ใ‚‹" ;
span.setAttribute('class',"reviewLink") ;  span.setAttribute('onclick',"window.open(`https://www.amazon.co.jp/review/create-review/ref=cm_cr_arp_d_wr_but_lft?ie=UTF8&channel=reviews-product&asin=${document.location.href.match(/https:\\/\\/www.amazon.co.jp\\/.*?\\/(.*?)\\/.*/)[1]}`, '_blank')") ;
document.querySelector('#acrPopover').appendChild(span);

Share this article

Shou Arisaka Oct 25, 2025

๐Ÿ”— Copy Links