I'm using iframe wrapper menu to add my own custom code. Inside the custom code, there is this button when click will generate a link to open another page. I'd rather have it as clicking the button and immediately go to that another page. I did so but that another page will show inside the iframe wrapper content instead of opening new window. Any idea how to redirect that another page to a new window after click button in iframe wrapper page?
1 Answer
As long as you can edit the contents of the iframe wrapper, you can use the target
attribute. There are several options depending on what you want to do:
<a target="_parent" href="yourlink.html">Text</a>
Will open the link in the parent frame<a target="_blank" href="yourlink.html">Text</a>
This will open the link in a new browser window<a target="_full" href="yourlink.html">Text</a>
This will open the link in the full browser window<a target="framename" href="yourlink.html">Text</a>
This will open the link in the frame named framename. It will be created if it doesn't exist.
-
I tried <a> tag attribute and it works fine of course, but rather than create a link using a tag to open that another page, I'd rather use the button to directly open that another page than generate a link (<a> tag)... But whenever I clicked the button to go directly to that another page, it showed the page within the iframe wrapper instead of new window.– AnnieOct 14, 2015 at 7:10
-
What code are you using to display the button? Can't you simply style your tag like a button using CSS?– johanpwOct 14, 2015 at 11:15
-
I'm using <input type="submit" value="Go">, when user click that, that page itself will do processing to check whether she/he has the access rights before going to another page...– AnnieOct 15, 2015 at 0:06
-
Have you tried adding the
target
attribute to your<form>
, e.g.<form target="_parent" action=...
? However, it would probably be better to avoid using an iframe if possible. There are many ways to include custom code in your articles and modules, with extensions like Sourcerer or Custom HTML Advanced.– johanpwOct 15, 2015 at 0:23 -
omg! it works!! thanks for your help! why it would be good to avoid using iframe?? I think that's the easiest way to add custom code in joomla menu instead of using another extension or plugin...– AnnieOct 15, 2015 at 3:27