跳到正文
DEV Community· HuDaTech·· 3 小時前AI 評分54

HuDaTech 推出 Page-to-Prompt Chrome 擴充功能,一鍵將網頁內容傳送至 AI

I built a Chrome extension that sends any web page to your favorite AI in one click

AI 導讀

HuDaTech 開發的 Page-to-Prompt 是一款 Chrome 擴充功能,可將選取文字、網頁內容、網址或標題連同提示詞帶入用戶選擇的 AI 對話。

正文

Cover image for I built a Chrome extension that sends any web page to your favorite AI in one click

HuDaTech

Hey DEV! 👋 I'm hudatech, an indie maker from Vietnam. This is my first post here, so I'll start with the thing I've been building: Page-to-Prompt.

The problem

I read a lot online, and I kept doing the same thing: select some text, copy it, open an AI tab, paste it, type "summarize this" or "explain like I'm five", hit enter. Then repeat for the next article.

It's only a few steps, but it adds up. I wanted the page I'm reading and the AI I'm chatting with to be one click apart.

What Page-to-Prompt does

It's a Chrome extension that works as a bridge between the page you're viewing and your AI chat.

  1. Pick a source: highlighted text, page content, page URL, or page title.
  2. Pick an AI: Claude, ChatGPT, Grok, Gemini, Perplexity, Copilot, or Qwen.
  3. Click a prompt. The AI opens with your prompt and the content already filled in.

You can open it from the right-click menu, or with Cmd + Shift + P (you can change the shortcut on Chrome's extension shortcuts page).

A few details I care about

  • Reusable prompts with a placeholder. Write a prompt once, drop {{SELECTED_TEXT}} wherever you want your selection to go, and reuse it anywhere.
  • Clean page content. The "Page Content" source uses Readability plus some tweaks of my own, so the AI gets the article and not the menus, ads, and cookie banners.
  • Conversations continue. The extension remembers the AI tab it connected to, so follow-up prompts land in the same conversation instead of opening a new chat every time. You can use several AIs at once, and each tab is remembered separately.
  • Per-prompt keyboard shortcuts. Assign a shortcut to a prompt and run it without touching the mouse.
  • Your own accounts. The AIs run in your own web accounts. The extension doesn't sit in the middle of your chats, it only connects the page to the AI.

What I'm learning building it

1. Messaging can fail in places you forget about.
My shortcut handler sends a message from the background script to the content script of the active tab. It worked great on normal pages, but on pages where no content script is running (like the extension's own options page), Chrome throws Could not establish connection. Receiving end does not exist. The fix was simple: wrap the call in a try/catch and show a friendly message to the user instead of a silent console error.

2. Never hardcode a keyboard shortcut.
I first treated Cmd/Ctrl + Shift + P as the extension's shortcut. But users can change it on Chrome's extension shortcuts page, so any check that depends on it has to read the real command shortcut at runtime.

3. Raw page text is a bad prompt.
Sending document.body.innerText to an AI means sending menus, ads, and cookie banners too. Running the page through Readability first (and adding a few tweaks on top) made the prompts much cleaner.

4. Be specific about permissions.
Broad permissions like access to all sites need a clear justification in the Chrome Web Store listing. Writing down exactly why each permission is needed forced me to double-check that I really needed it.

Try it

Page-to-Prompt is available on the Chrome Web Store.

I'd love your feedback, especially on which prompts you'd want as defaults and which AI sites I should support next. What do you use AI for while browsing? Tell me in the comments 👇

來源:DEV Community · dev.to