简体   繁体   English

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

[英]Link to open in a new window, with 2 frames

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. 基本上,我试图复制Google图片在2个框架的窗口中打开链接的技术-顶部框架具有“删除框架”选项,底部框架显示链接的内容。

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! 无论如何,感谢您的解决方案!

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. 假设您是通过解析RSS feed构建链接的,那么我将打开一个新窗口,并在您网站的iframe中显示新闻项。

If the RSS feed looks like this, for example 例如,如果RSS feed看起来像这样

    <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: 解析出链接并创建一些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>

Then you create a page called myiframe.php. 然后,创建一个名为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 ). 它显示您网站的外部框架,并带有指向要返回的链接的位置,并在中心显示来自RSS feed的URL(作为参数传递)。

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. 我建议您不要轻易复制浏览器提供的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM