如何打开 popup/new 选项卡 (target="_blank") 并尊重移动设备(以及桌面设备)?
How to open popup/new tab (target="_blank") and respect mobile (and desktop too)?
我有一些社交分享链接可以分享 post。这必须在新的 popup/tab/window 中。你知道的,我们都知道在 FB 等上分享东西的盒子
桌面版不需要新标签页,所以我使用的是:
<a href="popup-example.html" target="popup-example" onClick="javascript:open('', 'popup-example', 'height=400,width=400,resizable=no')">
但现在我在问自己如何为移动设备制作它..
也许只是一个 php 脚本来检测它是否是桌面,而不是使用上面的示例。如果是移动设备,请使用 <a target="_blank"
?
这是正确的方法吗?或者我是否需要 Facebook 应用程序的移动挂钩?
试试怎么样:
javascript:open('http://domain.com', 'popup-example', 'height='+window.innerheight+',width='+window.innerwidth+'resizable=no')
这将在新浏览器中打开 window 用于桌面(弹出)和单独的移动选项卡?
您无法在移动设备上打开自定义大小的浏览器window。因此,您不需要针对 运行 您在移动设备中的代码的特殊解决方案。
我有一些社交分享链接可以分享 post。这必须在新的 popup/tab/window 中。你知道的,我们都知道在 FB 等上分享东西的盒子
桌面版不需要新标签页,所以我使用的是:
<a href="popup-example.html" target="popup-example" onClick="javascript:open('', 'popup-example', 'height=400,width=400,resizable=no')">
但现在我在问自己如何为移动设备制作它..
也许只是一个 php 脚本来检测它是否是桌面,而不是使用上面的示例。如果是移动设备,请使用 <a target="_blank"
?
这是正确的方法吗?或者我是否需要 Facebook 应用程序的移动挂钩?
试试怎么样:
javascript:open('http://domain.com', 'popup-example', 'height='+window.innerheight+',width='+window.innerwidth+'resizable=no')
这将在新浏览器中打开 window 用于桌面(弹出)和单独的移动选项卡?
您无法在移动设备上打开自定义大小的浏览器window。因此,您不需要针对 运行 您在移动设备中的代码的特殊解决方案。