I'm using iframe to open a website in html. However, many target attributes are _blank and _top in the website.
我正在使用iframe在html中打开一个网站。但是,网站中的许多目标属性是_blank和_top。
Therefore, the pages always open in a new window.
因此,页面始终在新窗口中打开。
How to force the link open in same inframe in html?
如何在html中强制链接在同一个框架中打开?
My code below:
我的代码如下:
<iframe name="inapp" frameborder="0" src="http://www.w3schools.com" target="_self"></iframe>
1 个解决方案
#1
2
I'm afraid you can't if you are embedding a page from another website. There's strict cross-domain security measures in browser to prevent your page from accessing the contents of the iFrame. If you have control over the underlying page, then that's different, but I guess you wouldn't have the target issue in the first place.
如果你从其他网站嵌入一个页面,我恐怕你不能。浏览器中存在严格的跨域安全措施,以防止您的网页访问iFrame的内容。如果你可以控制底层页面,那就不一样了,但我想你首先不会遇到目标问题。
#1
2
I'm afraid you can't if you are embedding a page from another website. There's strict cross-domain security measures in browser to prevent your page from accessing the contents of the iFrame. If you have control over the underlying page, then that's different, but I guess you wouldn't have the target issue in the first place.
如果你从其他网站嵌入一个页面,我恐怕你不能。浏览器中存在严格的跨域安全措施,以防止您的网页访问iFrame的内容。如果你可以控制底层页面,那就不一样了,但我想你首先不会遇到目标问题。