I am trying to open an external url "https://stackoverflow.com/" on a new tab on opening a page in internet explorer. I have the code for it but when I try to open the page it gives me this dialog box screenshot below. Once I click on Allow Blocked Content then it opens my page in a new tab :
I do not want the user to make any changes to his Internet explorer settings. Is there any changes I can make my code open the "https://stackoverflow.com/" url without the above dialog box ?
<html>
<head>
<script>
function LoadF() {
window.open('https://stackoverflow.com/')
}
</script>
</head>
<body>
<body onload = "LoadF()">
<center><a target="_blank" href="https://stackoverflow.com/">Stack Overflow</a></center>
</body>
</html>
As a shameless copy-paster, It is my duty to notify you that this question was already answered.
To summarize, there are two major points to note:
This bar will only appear when running the page locally, and should not therefore appear when loading the page from a web server.
You can add a line at the top of your code to tell IE that the local file is safe: <!-- saved from url=(0014)about:internet -->
Related
I have a local html file on my desktop, when i click on it, if I already have chrome open with several tabs open, it will open my local file in the chrome browser in a new tab.
I want it to open in a separate chrome browser window, so its the only webpage open in that window, no other existing tabs should be open.
I also want to resize the window and ive tried something like this in the header of the html file
<script type="text/javascript">
var myWindow;
function resizeWinTo() {
myWindow.resizeTo(600, 600);
myWindow.focus();
}
window.onload = resizeWinTo;
</script>
but it does not work.
How can i do this, open in a new browser window and then resize that window?
EDIT: Just to clarify, I'm clicking in a html file icon on my desktop, not on a link to an html file within some webpage.
EDIT 2: So ive tried doing what some answer has said below, as a test I have created a simple 'hello world' html page called 'myfile.html' which is saved to my desktop, the code for the file is
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
OpenInNewWindow();
var WindowReference;
function OpenInNewWindow()
{
WindowReference = window.open("http://www.google.com",
"DescriptiveWindowName", "resizable=yes,scrollbars=yes,status=yes");
}
</script>
</head>
<body>
<H1> HELLO WORLD! </H1>
</body>
</html>
But if I already have my broswer open (my be minimized) with say some pages open, say bbc.com and cnn.com, so I already have two tabs open. When I double click on 'myfile.html' on my desktop, it just opens a third tab in my existing browser.
But I want a completely new separate browser window to open, how can this be done?
Here is what you can do.
Press win + R to open Run, enter regedit and press enter
Go to HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command
You should see one key, named (Default). Double click this to get an editing pop-up.
Change the key value
From
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -- "%1"
To
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "%1"
Now whenever you open any saved html page you should be able to see in a new window.
Source
I have a JSP page that pops in a new window from an application I am working on, retrieves email information, along with other data and constructs some email meta data. The code then triggers a basic mailto: call which pops up local mail client. The page that calls the mail client is supposed to close via a basic window.close but it remains open after the mail client is launched. The same code works in Firefox/Chrome. Ive stripped out all the JSP code but the below is the basis of the page, and the same issue occurs with this lightweight version.
<html>
<head>
</head>
<div class='PagePanel'>
<a id="SendEmail" href="mailto:test#test.com"></a>
<script language="JavaScript">
document.getElementById('SendEmail').click();
</script>
<script language="JavaScript">
// automatically close the newly launched browser window displaying this page as no widgets are painted on this page
window.close();
</script>
</div>
</html>
Any one know why the page doesn't close in IE9? (IE9 support needed) Closes in Firefox and Chrome.
I'm having a problem trying to get this to work. Here's my situation:
- using SAP Portal I'm launching an html page with the code below
- the html page needs to launch a brand new window
- the existing html page then needs to redirect itself back to the main portal page
- the newly launched window then needs to be brought to the forefront (set focus)
The issue is that when the portal reloads after being redirected it takes focus. I also don't have access to the code of the application that I've launched in the new window so can't do anything there.
Here is the code I'm trying to use. I've also tried to use a setTimeout() as well but it doesn't work.
<html lang="en-US">
<head>
<meta charset="UTF-8">
<script type="text/javascript">
window.open('https://passwordresetprogram','_blank');
window.top.location.href="http://originalurl";
</script>
<title>Password Reset</title>
</head>
<body>
</body>
</html>
when I tried the commands in console
window.open('https://passwordresetprogram','_blank');
window.top.location.href="http://originalurl";
it works as you mentioned
the html page needs to launch a brand new window
the existing html page then needs to redirect itself back to the main portal page
the newly launched window then needs to be brought to the forefront (set focus)
and
to access the code of the application launched in new window, try this
<script type="text/javascript">
var popUp="";
function OpenNew(passedURL){
popUp = window.open('https://passwordresetprogram','_blank');
popUp.document.getElementById("<some_selecior>").<some_attribute>=<some_code>;
}
</script>
I'm Redirecting to google play store(The App) in Android Phones via some referral link but I'm unable to close the browser tab after redirection. I tried window.close(); but it's not working.
just like here if you click this link in mobile chrome broswer it will prompt up for Android Play store. flipkart.com/mobile-apps
<body>
<script>
window.location.href = "https://play.google.com/store/apps/details?id=com.bt.bms";
</script>
<noscript>
<meta http-equiv="refresh" content="0;URL= " http:>
</noscript>
</body>
Closing a tab is not allowed by most browsers. Some will display an alert asking the user if he wants to close the tab.
Can you not simply link to the Google Play Store by using the current tab? Instead of opening a new one?
Download My App
The target="_self" is the default so its unnecessary.
If you want to just show the Google Playstore in a new tab/window just add a link to your page like this:
Download My App
That will open the Playstore in a new tab.
I have a website build in php, in some page i show a iframe with another website link, which displays it's login screen.
Both Websites are in different domain.
Like main website : http://www.abcd.com
Iframe href : http://www.xyz.com
Now my users see a page in abcd.com where there is an iframe like
<iframe src="http://www.xyz.com/" style="width:688px; height:384px;"></iframe>
Which displays the login screen of the xyz.com
Now what i want is, if users login to xyz.com another new tab should open with the homepage, after login of xyz.com and abcd.com tab should get close.
Is it possible to do with javascript or jquery, which works for all the browser including IE 7,8,9 ??
Thanks
Open up a new tab
link
linky
pop up
window.open("foo.html", "_blank");
Put the following javascript code in the <head> tag of the homepage of xyz.com (but don't put it in the login page if you still want to keep the login page inside the iframe):
<script type="text/javascript">
if (top.location!= self.location){
top.location = self.location
}
</script>
now, when opening the home page of xyz.com, this code will break the <iframe> and changes the current tab from abcd.com to the home page of xyz.com
i dont know what you mean, but opening a new tab from iframe is just the normal code.
<button>Open New Tab</button>
hope this helps
What you're trying to do is impossible on your end, you only supply a login page inside the iFrame, therefor you cant control what the "login" button actually does, it's controlled by the other website.
The other website will need to edit the action themselves and add target='_blank', but that wont happen as their users will have another tab when they login.