為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

How to stop opening a new tab from a link in a frame?

more options

I make use of an application that allows me to open a website in a frame within a tab. As long as i click on a link that let's me stay on that webpage the site stay's within the frame. But if the link revers to another website/url i get a new tab instead of the website being opened within the frame. I have figured out how to block opening a new tab or window, but i cannot find out if i can do the same with a frame.

I make use of an application that allows me to open a website in a frame within a tab. As long as i click on a link that let's me stay on that webpage the site stay's within the frame. But if the link revers to another website/url i get a new tab instead of the website being opened within the frame. I have figured out how to block opening a new tab or window, but i cannot find out if i can do the same with a frame.

被選擇的解決方法

This is difficult to test because in most cases I get this error trying to force external links to open in the iframe:

Load denied by X-Frame-Options: <URL> does not permit cross-origin framing.

Anyway, since the built-in setting doesn't do what you want, I think you will need to "hack" the framed pages to modify the link destinations using an add-on, either an extension or a userscript.

從原來的回覆中察看解決方案 👍 1

所有回覆 (3)

more options

What method did you use for this:

Tiemen said

I have figured out how to block opening a new tab or window, but i cannot find out if i can do the same with a frame.

For example, did you modify this preference to force links targeted toward a new window back into the same tab:

(1) In a new tab, type or paste about:config and press Enter. Click the button promising to be careful.

(2) In the filter box, type or paste link.o and pause while the list is filtered.

(3) There are three similarly named preferences for different scenarios, we're going to focus on the first one, but I mention the others in case you have a question when you see them:

(A) browser.link.open_newwindow - for links in Firefox tabs

3 = divert new window to a new tab (default) 2 = allow link to open a new window 1 = force new window into same tab <== Does this work?

(B) browser.link.open_newwindow.restriction

0 = apply the setting under (A) to ALL new windows including script windows with features (dialog windows) 2 = apply the setting under (A) to normal windows, but NOT to script windows with features (default) 1 = override the setting under (A) and always use new windows

(C) browser.link.open_newwindow.override.external - for links in other programs

-1 = apply the setting under (A) to external links (default) 3 = open external links in a new tab in the last active window 2 = open external links in a new window 1 = open external links in the last active tab replacing the current page

You might want to choose 2 for this one after testing the first change.

Does that do what you want?

more options

Dear Jscher2000,

I tried all these solutions but this seems not to work for a page with frames.

I have a webpage and on this page a frame has been defined and in it a webpage is running. This page is functioning normaly. The moment i click on a link that leads me away from this page a new tab or window is being openend. I don't want this to happen. It should open this new page in the excisting frame.

kind regards Tiemen

more options

選擇的解決方法

This is difficult to test because in most cases I get this error trying to force external links to open in the iframe:

Load denied by X-Frame-Options: <URL> does not permit cross-origin framing.

Anyway, since the built-in setting doesn't do what you want, I think you will need to "hack" the framed pages to modify the link destinations using an add-on, either an extension or a userscript.