<base target = _blank> not working for iFrame in IE11 - javascript

In My application on click of a link i open one POPUP window which has one button which opens another POPUP window, which has one Iframe and one dropdown for language. On change of dropdown iFrame body gets changed dynamically like below
$('#tncFrame').contents().find('body')[0].innerHTML="<base target='_blank'/>" + $scope.tncFileContent;
$scope.tncFileContent this is a dynamic html content.
I have prefixed <base target='_blank'/> to the html so that links in the dynamic html content open in new window.
IN FF and Chrome its working fine but not in IE. Can anyone help me out.
Thanks

In IE 11, only links to the same domain work in IFRAMEs. Linking to domains other than the one the page loaded from is prohibited now. Links with target=_blank attribute are ignored unless they are pointing to the domain from which the page loaded. I have tested this with Google's reCAPTCHA and it is true.
I wrote about this yesterday in a blog article on my site.
http://rickcable.blogspot.com/2018/03/internet-explorer-11-and-google-captcha.html

Related

iframe embeded website - href link not opening in external browser

I have an app and website. I want one of my website pages inside the app so I embedded it with iframe and it looks/works great except for one problem. All the href links inside my website open inside the app and cover the entire app (tabs and header). I would like the href links to open in safari/chrome externally. I've tried setting the href's target to _blank, _system, _parent, and _top. But they all still give the same behavior.
Can anyone give an idea that might help?

How do I get Joomla to stop opening every link in a new tab?

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.

preventing external page from redirecting MY (parent) page

Using the latest version of Chrome on Mac OS 10.7.
I assume it is some clever javascript that is enabling the folks at this webpage:
http://www.chairworks.com/
...to close my (the parent) page which opened their (chairworks.com) page in the first place.
I did not open them with javascript, but with an <a> tag with the target="_blank" attribute.
If I disable javascript, then the behavior stops.
www.chairworks.com
I would expect the page at chairworks.com/ to simply open in another tab/window... but what I find is that as soon as the new browser tab opens, it closes, and then my page (the parent tab/window) gets redirected to the chairworks.com page.
Kinda rude.
Can someone point me to what code enables them to do that? And how do I prevent it? (Assuming I want a link to behave as expected, such as in my demo page.)
I believe the proper thing to do is set corresponding link type attribute so the browser doesn't provide the target window with and opener reference.
Link
You can read more about link types here: https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types
This is the script they are using:
setTimeout('redirect_page()',0);
function redirect_page(){if (window.opener) { window.opener.location.href = '/home.html'; window.close(); } else { location.href = '/home.html'; }}
As to how to circumvent it (just an idea):
Create your own blank page, with it's source set to about:blank. When it loads (or after a time-out) you could write some code to that window that will then open the offending link.
Then the offending link just closes your buffer-page. F*ck 'm!! Power to the user!
Edit: looks like you could also name your page home.html hehe, but that is not such a workable solution..
Final Edit: SIMPLE LOGIC people...
www.chairworks.com
works for everyone, no javascript needed.
See this working jsfiddle example.
As #GitaarLAB explained, the targeted website is using the window.opener property to get access to your page. Using some Javascript yourself, and an about:blank page in the middle, can help you cut their access to your page. It would be like:
http://www.chairworks.com/
Some notes:
I'm leaving the href property there for users without JS enabled (guess what! the targeted website won't have JS neither! ;), or the web crawlers like search engines' (only those who don't care about JS stuff, though)
Before redirecting to the targeted website, you cut the back-link by resetting the window.opener attribute of the new window.
And after opening the targeted website, there's a return false; to prevent the normal the browser to use the href and target attributes.

Iframe scroll due to the links inside it

I have a page with a fixed header div like a tool bar and an Iframe which loads content form the same/different domains.
The problem is whenever a link inside the iframe is clicked, it scrolls the page to the top hiding the toolbar itself. This happens in desktop/mobile webkit browsers.
Note:- I found the reason for why the iframe scrolls the parent page when any link inside it is clicked, it turns out that if the anchor tags within the iframe have empty hash values i.e href="#" and if they are clicked then it causes the parent page to scroll to point from where the iframe starts. This happens in webkit browsers only for me. This is not reproducible in FF.
If you are dealing with the problem in Javascript simply use this code:
ifrm.setAttribute("onload","scroll(0,0);"); //(ifrm is the id of the iframe)
or
<script language="javascript">
function totop() {
scroll(0,0);
}
</script>
and in your html for iframe, add an onload attribute as below:
<iframe name="iframe" onload="totop()">
Got this 2nd solution from another forum, and changed to the 1st one to suit my requirement as I am creating the iframe element and setting its properties in javascript and not in html. It worked for chrome as well as IE. FF didn't have the problem in the first place.

Open link in a tab from chrome extension's iframe

I have developed a pop up extension for google chrome. I have added an iframe in that popup. Now when i try to open a link from that iframe.. its not working.. its not even working within the iframe itself. i need the links in iframe to be opened in a new tab.
I tried writing some scripts which can change href in a to be opened in a new tab or in the same tab. But how to do that for an iframe.
Note: The page loaded in iframe is in my control and can be changed if needed.
Put <base target="_blank"/> into <head> of that iframe. You can also mark individual links with target="_blank".

Categories