链接在新窗口中打开,有 2 个框架

发布于 2024-08-28 21:50:31 字数 281 浏览 6 评论 0原文

我将在我的网站上显示来自外部网站的新闻源。因此,我需要在新窗口中打开这些提要中的外部链接,但为用户提供返回我的网站的选项。

基本上,我试图复制谷歌图片的技术,在带有 2 个框架的窗口中打开链接 - 顶部框架有一个“删除框架”选项,底部框架显示链接的内容。

另外,由于新闻源是动态的,我不想对任何内容进行硬编码。新闻提要中出现的任何链接都应该自动使用该代码。

关于如何做到这一点有什么想法吗?


我决定不实施这个。设法让我的客户相信这是一个坏主意。无论如何,感谢您的解决方案!

I will be displaying news feeds from external websites on my website. So i need to open external links in those feeds in a new window, but give the user an option to return to my website.

Basically I'm trying to replicate Google Images' technique of opening a link in a window with 2 frames - with the top frame having an option to "Remove Frame" and the bottom frame displaying the content of the link.

Also, since the news feed will be dynamic, I don't want to hard-code anything. The code should be used automatically by any link appearing in the news feeds.

Any ideas on how to do it?


I've decided to not implement this. Managed to convince my client that its a bad idea. Anyways, thanks for your solutions!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

锦上情书 2024-09-04 21:50:31

假设您通过解析 RSS 提要来构建链接,我将打开一个新窗口并在您网站的 iframe 中显示新闻项。

例如,如果 RSS 提要如下所示,则

    <item> 
            <title>Apple delays iPad's global launch</title> 
            <link>http://www.cbc.ca/technology/story/2010/04/14/tech-ipad-launch-delay.html?ref=rss</link> 
            <guid isPermaLink="false">2000360126</guid> 
            <pubDate>Wed, 14 Apr 2010 11:20:49 EDT</pubDate> 
            <description>The launch of the iPad tablet outside the U.S. will be delayed one month until the end of May, Apple Inc. has announced.
            </description> 
        </item> 

解析链接并创建一些如下所示的 HTML:

<a href="myiframe.php?story-url=http://www.cbc.ca/technology/story/2010/04/14/tech-ipad-launch-delay.html?ref=rss" >he launch of the iPad tablet outside ...</a>

然后创建一个名为 myiframe.php 的页面。它显示网站的外部框架,其中包含要返回的链接,中间显示来自 RSS 提要的 URL(作为参数传递)。

Assuming you are constructing the link by parsing an RSS feed, I would open a new window and display the news item within an iframe on your site.

If the RSS feed looks like this, for example

    <item> 
            <title>Apple delays iPad's global launch</title> 
            <link>http://www.cbc.ca/technology/story/2010/04/14/tech-ipad-launch-delay.html?ref=rss</link> 
            <guid isPermaLink="false">2000360126</guid> 
            <pubDate>Wed, 14 Apr 2010 11:20:49 EDT</pubDate> 
            <description>The launch of the iPad tablet outside the U.S. will be delayed one month until the end of May, Apple Inc. has announced.
            </description> 
        </item> 

parse out the link and create some HTML like this:

<a href="myiframe.php?story-url=http://www.cbc.ca/technology/story/2010/04/14/tech-ipad-launch-delay.html?ref=rss" >he launch of the iPad tablet outside ...</a>

Then you create a page called myiframe.php. It displays an outer frame of your website with a link somewhere to return, and in the center displays the URL from the RSS feed ( which was passed as a parameter ).

如若梦似彩虹 2024-09-04 21:50:31

如果您要在新窗口/选项卡中打开提要,则用户可以选择通过关闭窗口/选项卡返回您的网站。我建议您不要特意复制浏览器提供的功能。

If you're going to be opening the feeds in a new window/tab, the user already has the option of returning to your site by closing the window/tab. I would advise that you not go out of the way to replicate functionality provided by the browser.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文