I'll try and keep this short. I have a page with various section. One section has an iframe with a google map in it. On the infowindows i have a link which when clicked i would like it to open in a fancybox over the page(not in the iframe...i can do that). For example if i had a link saying "google", id like it to open http://www.google.co.uk/ over the whole page in a fancybox.
I have 2 different pages and 2 javascripts, 1 for the map(iframe) and another for the main page. The function is in the main page script.
Where i think im going wrong is a) the right call to open the page b) attaching a class to the javascript i.e class="fancybox".
My map info window has this link in it(map.js):
some content
In my main.js:
function openSomething() {
//this is where i think im going wrong
//ive tried window. and top. etc
var url = "http://www.google.co.uk/";
document.location.href = url
};
My call to the fancy box is in the main page.
Any help would be much appreciated.
No need to use JavaScript: set the desired link as the href attribute, and use the target attribute to define where it is opened.
target="_top" will open the new link in the entire page
target="_parent" will open it in the parent frame or page
target="_blank" will open it in a new window.
Related
I changed a domain name of my website, and now every link opens in new tab (menu, logo, external links etc.) I want to know how to get back to normal behavior when Joomla opens only external links in new window. How can I solve this and what could be the cause of it?
Link to my website: http://sparkle-soft.com
I'm using Joomla 2.5
You have a inline script tag in your head for some sort of specialtrack. There is a line of code within the function that is applying a blank target attribute to all links on your page:
links[i].setAttribute('target', '_blank');
Check to see what tracking you have added to your site, look for any options if provided that would allow you to change this. It could be coming from an extension or your template but hard to tell as it's inline, rather than a source file.
My question is I want to open a advertisement but condition is .. when i click on data url
at that time data url opened also with another new window advertisement also open.
So how i write a code so open two page : one my content(data) page and another is
advertisement page..
Please give me a answer for my problem.
Run an onClick="function()" and a link.
<div onClick="openAd()"></div>
<script>
var function = openAd(){
window.open("ad");
}
</script>
Here I use window.open(), which does what it sounds like and opens a new window with the link.
Is this possible at all? I'm building a simple Facebook app and want a button to load an external link in a _blank window, while the next page of the app loads in the _self window. I'm very much a novice at JavaScript, so any help/advice would be very much appreciated!
Add a click event listener to your button that executes the following lines:
window.open('http://www.example.org/external_link.html', 'New Window');
window.location.href = 'http://www.example.org/internal_link.html';
The first line might get blocked by some popup blockers but let's give it a try.
So I have a page that contains an iframe. Inside the iframe, there are links that opens up new page in the same window (self.location.href) (window.open(urlstring,'false') etc...etc...
Is there a way that I could force all links inside this window to open up their contents in a new window/pop up? Overrides their redirect settings and without changing the code inside the iframe?
The reason I'm asking this is because that, I think the iframe page still references the parent window as their window, therefore, when the function like "window.self.open" was triggered, it took my whole parent window away...
Maybe anyway to embed the iframe as an separate window inside the page? Just not sure how to avoid the same window referencing...
Thanks!
You can set the links to open in a new window by adding target="_blank" to the a element (e.g. Example).
If you want to have this applied to all links without touching the links themselves, you can include a jquery function to do it for you:
$("a").attr("target","_blank");
You could also add the target attribute to a base-tag within the header.
<base target="_blank">
This will be applied to all links as well.
This is a tricky one. I have a link on my page that opens a Colorbox iframe to an external website. The external website contains links to another page. When the user clicks those links, I need them to load up in the same iframe.
The problem is, the link on that external site is set to open a new window with target="_blank". Therefore, instead of this page loading within the same colorbox iframe like I need it to, it opens a totally new window.
Is there any way to bypass it so that these links within the iframe do not open a new window, and instead load that window within the same colorbox iframe?
Thanks in advance!
_blank will always open a new window, you could try _TOP instead, it should work something like this;
<a onclick="parent.$.fn.colorbox.close();" href="NEW SITE" target="_top">
open in parent window with animation
</a>
Do you control the document that is being displayed in the iframe? If so you could handle things a little differently so that you only opened new windows if the document isn't being displayed in an iframe. But if the document you are iframing isn't under your control then I don't think there is anything you can do about it.