🔍

首页Home › 开发工具Developer Tools

🪟 弹出窗口代码生成器Popup Window Code Generator

生成 window.open 弹出窗口的 JavaScript 代码:设置网址、窗口宽高、是否屏幕居中、滚动条和可调整大小,自动加上 noopener 安全选项,并生成对应的链接或按钮 HTML。Generate JavaScript for a window.open popup: set the URL, width and height, centring on screen, scrollbars and resizing, with the noopener safety option added automatically, plus matching link or button HTML.

使用说明与常见问题How-to & FAQ

「弹出窗口代码生成器」是什么?What is the Popup Window Code Generator tool?

生成 window.open 弹出窗口的 JavaScript 代码:设置网址、窗口宽高、是否屏幕居中、滚动条和可调整大小,自动加上 noopener 安全选项,并生成对应的链接或按钮 HTML。Generate JavaScript for a window.open popup: set the URL, width and height, centring on screen, scrollbars and resizing, with the noopener safety option added automatically, plus matching link or button HTML.

如何使用「弹出窗口代码生成器」?How do I use the Popup Window Code Generator?

填写网址和窗口参数,下方生成可直接使用的函数和 HTML。点击「试一下」可以在当前浏览器中打开测试窗口(浏览器可能拦截非用户点击触发的弹窗)。Enter the URL and window settings to get a ready-to-use function and HTML. Click Try it to open a test window in your browser (browsers may block popups not triggered by a click).

为什么弹窗被浏览器拦截了?Why was the popup blocked?

浏览器只允许在用户点击等操作中直接调用 window.open,页面加载时或定时器里打开的窗口通常会被拦截。请把代码绑定在链接或按钮的点击事件上。Browsers only allow window.open directly inside a user action such as a click; windows opened on page load or in timers are usually blocked. Bind the code to a link or button click.

noopener 有什么作用?What does noopener do?

不加 noopener 时,新窗口可以通过 window.opener 修改原页面地址(钓鱼风险)。加上后新窗口与原页面断开联系,更安全,但 window.open 会返回 null。Without noopener the new window can redirect the original page through window.opener (a phishing risk). With it the windows are disconnected and safer, but window.open returns null.

「弹出窗口代码生成器」免费吗?数据会上传吗?Is the Popup Window Code Generator free? Is my data uploaded?

「弹出窗口代码生成器」完全免费,无需注册或安装,手机和电脑都能用;所有处理都在你的浏览器本地完成,输入的内容和文件不会上传到服务器。The Popup Window Code Generator is completely free with no sign-up or install and works on phones and desktops; everything runs locally in your browser and nothing you enter is uploaded.

相关工具Related tools

↪️ 网页跳转代码生成Redirect Code Generator🧾 HTML 格式化/压缩HTML Beautifier & Minifier🏷️ SEO Meta 标签生成器SEO Meta Tag Generator🔄 网页定时刷新Auto Page Refresh🌐 URL 编码解码URL Encode / Decode

← 全部工具All tools