Iframe target parent not working - php

I'm doing a website that is a more actual menu than the actual one, and I'm just using iframes to organize the content.
When you click on an item of the menu, it has a link to the same webpage with a get parameter, where there is a switch option that read the param and print the correct iframe.
The problem is that when I go to some menu and this menu has different options, it is printed the first menu with some link and, when I clik on one of these links, I'm redirected to correct website but in a new window. Is it possible to be always in the same window?
I have just tried with or "_self" but it is not working. The server is the same for both websites but they are located on different folders, so I'm using absolute paths because is easier (My idea is to implement it and later improve step by step).
Thanks!

If you want to update what is inside an given iFrame, than the iFrame needs a name (be sure to use a unique name) and the link that's supposed to update your iFrame needs a target.
Here's an example:
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p>W3Schools.com</p>
If you want to update the parent page (the one, that has the iFrames in it), then use target="_parent" within the <a>-tag.
_self is the frame or window, that the link is called from.

Related

How to hide the href URL from users

I understand that it is possible to hide the url in the browser status bar by using javascript, but with this method, the url can be seen when the source is viewed from the browser.
how to hide URL from downloadlink?
We are using PHP Laravel.
I would like to know how to create a link button so that the user does not see the url. I am assuming that this might need to be implemented at the server (controller) side not a view side.
I would like to know the easiest way.
There are basically three different ways to hide links in HTML.
The first way is to use the tag without the href attribute. This hides the link from the HTML reader, but the link will still be clickable in the browser.
The second way is to use the tag with the href attribute, but place the entire link inside a span tag.
The third way is to place the entire link inside a span tag, and then you can use CSS to hide that span tag.
Whichever way you choose to hide the link, your link will still be clickable. When the link is clicked, it will still open in the browser window. Hiding links is very easy in HTML.

Defining New Window Target When Linked from an Iframe

I was asked to create several websites that essentially mirror a specific live website. With the difference between the live site and the new sites being that there is a floating header that displays at the top of the page no matter how far you scroll down. This is the same technique that sites like StumbleUpon use. My initial thought was to use an Iframe, for the view portal and a absolute div for the header. However I was then asked to make it so that when someone clicks on a link within the iframe that they be taken to the actual site, in a new window. This is the part that has me thrown. Is there a way to tell the I frame to open all links in a new target? If not what would you recommend?
See attached image for clarification:
Targeting blank in the anchor should work just fine here.
<a target="_blank" href="http://google.com">google</a>
With some cross browser hacks you may be able to tell when the iframe src changes, on that basis you could then reload the page in a new window. It isn't possible though to tell what the new URL is, so it won't be the best user experience as you'll be sending them back to the page that you loaded originally.
http://www.nczonline.net/blog/2009/09/15/iframes-onload-and-documentdomain/

Can I load a domain in my iFrame and when you click a link, it opens in the parent window, not the iframe?

Similar to Stumbleupon, if you load random domains (ones that I do not own) and want to have the links within that page not just change within the iframe, but change on the parent url.
If that's hard to understand here's more layman terms:
URL: mywebsite.com/reddit.com
opens iframe on my website showing: reddit.com
click link within the iframe (showing reddit.com).
rather than it loading the new page in the iframe, can it load in the parent window at mywebsite.com/reddit.com/newlink
which would then open the iframe in my website, but would allow me to track what URL is being view and thus allowing me to perform my site-specific functionality.
Thanks!
in short, it cant happen. external sites are made to open links relative to their sites. there is no way to accomplish this.
you can set the link target to _top. <a href='www.someothersite.com' target='_top'>Link</a>
edit: Sorry, mis-read something. You can not edit the page on the other site through the iframe to change the target of the links. This is why on places like google images or stumbleupon they have an "X" in the corner that takes you to the page in the iframe.
If you could modify external pages, that would be a major phishing security risk as anyone could then make a page that is just an iframe to your bank but collects whatever you type into the username/password boxes.
In the old days if you made a page with frames you could specify what section your links took you to. Modifying links that aren't under your control is possible but rather a task and a half.
To use frames you could specify your target= within your tag. Each frame is named on creation to make it easy.
That's an old approach. Hope it helps

Break out of Iframe

I have a Joomla site, the content is loaded in an iframe from another site.
In this iframe I have another iframe (a news ticker), when I click on a link in the news ticker, a page should open in the parent iframe.
When I click on it now, it opens the correct page full screen, and not in the iframe in the joomla site.
(Inception!)
Go check it out:
http://www.rtc-antwerpen.be/Site/content/view/14/47/
Click on 'Hybridevoertuigen' in the scroller
Warning: This site is very old, ugly and slow, I just have to upgrade it.
Thanks
Within the a-tag you have to define target="_parent"
<a href="link.php" target="_parent">
This will cause the link to open in the parent frame.
EDIT:
What you seam to be trying to do, is target a div-block outside the IFrame, which is not possible (at least not with some JS running on your main site).
Are the contents you are linking contents, that exist within joomla? Then try to link to their correct URL.
For example, instead of "detail.php?id=435" link to "/Site/content/view/14/435". Then joomla will load the whole site, wrapping the content.
Except for target="_parent" (which should work if your site is structured like you described) or target="_self" (which should work in your site as it actually is structured now), you could also specify the name of a frame in target. That allows you to more specifically point to a target frame, and it is ignored if such a frame does not exist.

JavaScript - Basic URL rewrite + creating record in history

Here's the situation.
I have a site where clicking hyperlinks within a certain div makes a jQuery function get the content of a div from a separate page. Because of this, the URL don't change. I need it to change as well as writing an entry in history.
My pages are setup like this (not sure this is the smartest way of going though)
access.php (main logon)
new-user.php
forgot-pass.php
index.php
controlpanel.php
etcetc. Now, all of these pages are reachable on their own and are mainly identical and all contain a div called "container". When clicking links, the content from this div gets erased and the content from the coresponding div (container) gets loaded from the file of the URL (href). I'm terrible at explaining..
So basically, what I need is some javascript that picks up the href link address and just pastes it in the url bar at the same time as it creates an entry in history so the back and forth buttons work.
I plan on extending this in a while as well, translating query strings as well. But there are a few constant static pages I need to take care of first. Any help would be very appreciated! :)
You are not allowed to change the entire URL by JavaScript but you can use URL hashes. I recommend you the browser history plug-in. You can simply register a handler to react on URL changes and load your corresponding content via ajax.
Have you looked at the jquery address plugin? Look at the examples. Is this similar to what you want?
It's not possible with "normal urls" (we must wait for a new generation of browsers...)
But there is a "trick": playing with anchors.
A link like "same_page.php#anchor" does not reload the page, but act on both the history and the adress bar.
So, if instead of having url like "page.php?param=lorem", you could have "page.php#param=lorem", you have your solution :)

Categories