简体   繁体   中英

How to Open a url in new tab that changes the source location also and opens in new tab | Fail “target_blank”

我知道您可能认为这是一个愚蠢的问题,但是目前我面临一个URL问题,当我尝试在新选项卡中打开时,它也会更改当前源URL​​,并在新选项卡中打开另一个URL(例如,示例),我想打开它新标签中的url, http : //dolohen.com/afu.php?zoneid= 2458044现在,如果您转到: https : //www.ytsubme.com/_/eePEz/ ,然后单击“下载”广告图像,它会将用户重定向到新标签页,但也会更改当前网址,我厌倦了使用“ target =“ _ blank”属性,但仍无法正常工作,这是代码: https : //pastebin.com/AZZpVz6M

<?php echo '<a href="http://dolohen.com/afu.php?zoneid=2458044" "target="_blank"><img src="https://i.ibb.co/x3KHLmV/27-91918-Static-Red-Button-300x250.png" /></a>'; ?>

It's quite possible that the dolohen URL is exploiting the target blank vulnerability , which you're not protecting against. This would allow them to redirect your tab with window.opener .

To guard against this, you should add rel="noopener noreferrer" to your link:

<a href="http://dolohen.com/afu.php?zoneid=2458044" target="_blank" rel="noopener noreferrer">

In addition to this, you had a leading " on target , which has been removed in the above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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