← All examples

JavaScript Media ebay.com

eBay: open the full photo in a new tab

Adds a link below the main item photo that opens the full-resolution image in a new tab.

Code to copy

// Add an "Open full photo" link under the main item image
function addPhotoLink() {
  if (document.getElementById('jz-eby-photo-link')) { return; }
  const img = document.querySelector('.ux-image-carousel img, .ux-image-magnify__container img');
  if (!img || !img.src) { return; }
  const a = document.createElement('a');
  a.id = 'jz-eby-photo-link';
  a.textContent = 'Open full photo';
  a.href = img.src.replace(/s-l\d+/, 's-l1600');
  a.target = '_blank';
  a.rel = 'noopener';
  a.style.cssText = 'display:inline-block;margin:8px 0;font-weight:700;color:#2b3a8c';
  (img.closest('.ux-image-carousel') || img.parentElement).appendChild(a);
}
addPhotoLink();
const obs = new MutationObserver(addPhotoLink);
obs.observe(document.documentElement, { childList: true, subtree: true });

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases