Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Force target="_self" in iframe

Featured Replies

Hi - I'm displaying an external website in an iframe. The links in the external website, which I have no control over, use the "_parent" target which opens the link location in a new window. I would like to force the links to open within the iframe. Is it possible to force this using javascript? Thanks

Hi.


I don’t think you can target links in iframes with. JS. But you could open the entire external page in a small popup window with the window.open method. Then the links woud also open in the the same pop up.



I had a sudden thought about using PHP to include the external URL, but on second thoughts it wouldn't work.

I had a sudden thought about using PHP to include the external URL, but on second thoughts it wouldn't work.

Nope PHP include woulden't work either. You would get duplicate html, body and head tags and even if it did you could not change the target attributes anyway. Loading the page with AJAX request is a nogo to because the content hosted externaly. I think the only way to do it is to copy the sourcecode paste it in a div and change the target attributes either manually or with JS. But I don't think google will aprove copied content. I still think the best solution is to use a window.open popup instead of the iframe.

Thanks for clarifying. I didn't think it would work but I thought id throw the idea out there.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.