I am trying to open a certain page from my default page.
All the code there is in the default page is:
<script type="text/javascript">
window.open("StartPage.aspx", "", "fullscreen=yes");
</script>
The problem is that the browser's popup blocker blocks this and I need allow the browser to open it.
I want to avoid this and that every one that will use my web application won't need to allow the popup blocker to open the page. I want to pass the popup blocker and open the page without permission.
Is there a way to do so?
Thanks
adamantium is right. a popup blocker would be pretty useless if it could be overridden by the code that's causing the popup. the best you can do is this:
<script type="text/javascript">
var myPopup = window.open("StartPage.aspx", "", "fullscreen=yes");
if(!myPopup)
alert('a popup was blocked. please make an exception for this site in your popup blocker and try again');
</script>
As others have stated, you simply can't. The browser is blocking that behavior. Another option would be to not use window.open but instead use a javascript component which can give you the same behavior.
You won't be able to do that. Its a user preference to block pop up windows and you have no control over that.
You can open popup using onclick event only. You can try submitting form with target="_blank" and action set to your url, but forefox blocked this, google chrome not.
I don't think that's impossible, everyday I see streaming pages opening popups all the time and mine's being blocked so it should be a way to bypass it
Related
Help needed.
I have done a lot of R&D to come up with the solution on unblocking the pop-up on the browser but not been able to resolve this issue so I would like to know your valuable thoughts/solutions.
My requirement;
1. When user fills the form and get the successful message, then the new window appears in the same browser with external link.
I have tried the below tricks to solve this.
I have write the below code for new window.
window.open("/","NewWindow",'width=100,height=100');
OR
setTimeout(function() {
window.open("/","NewWindow",'width=100,height=100');
},1000);
OR
open("/","NewWindow",'scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=100,height=100,left=-1000,top=-1000');
Also I'm created an anchor and trigger click event, but pop-up is still getting blocked.
Please help.
I doubt it is possible. If a popup is blocked on the user's end, it's blocked. You cannot programmaticly unblock it.
However, you got alternatives:
You can use modals: Although it looks like one, a modal is not a popup, and it won't be blocked.
You can also ask the user to unblock your site from the popup blockers (show them a warning). Many sites do this.
i read a lot of solutions but all of them are clicking a url, and it works, but my client ask me to do is users opens his website, it automatically open a new tab with some special offers , so my question, is there any way to open a new tab without any user intervention? , maybe a jquery plugin?, i know the tabs rely on the web browser, but it have to be a way, a lot of web pages does it,but how?
Greetings
Without modifying the configuration of browser, the answer is no, only trusted event can open a new window (or tab)
You may ask if your client could change their browser's configuration to allow a popup window from an untrusted javascript program.
Write script in your page to open new page:
<script>
window.open("specialOffers.aspx");
</script>
and in the "specialOffers.aspx" page in the tag write:
<base target="_blank"/>
I am using facebook login button in website. when i clicked on that it opens a popup. insted of popup i want to open that in a iframe. is there any way to do that using javascript.
plz help me.
thanks in advance.
Show some of your code. Is the code that opens the popup yours or included from some other site? If it's not your own code and it uses window.open, there's nothing much you can do.
If it's your code, use something like this onClick: document.getElementByID('iFrameID').src=url;
Keep in mind that if the facebook-login (which will be an external page) expects to be running in a popup window could execute window.close to return to your page, which may cause problems if you're using an iFrame.
I want to open a new window in button click.I have used a code.
Response.Write("<script type='text/javascript'>detailedresults=window.open('YOURPAGE.aspx','_blank');</script>")
It is behaving like a pop up window,but it is not working in IE 7.0 & Chrome.Please help me to solve that issue.Thanks in advance.
In most modern browsers, the browser will prevent the pop-up if the javascript wasn't run as the result of a user action. Actions like onClick are ok, but script that executes as soon as the page loads will usually be blocked.
HTH,
Brian
Why not set the target to _blank on an anchor tag instead of a button? e.g.
<a href="yourpage.aspx" target="_blank" />
Does that work for you?
Due to the prevalence of very irritating adverts and attacks based around opening a popup window as soon as a page loads, most modern browsers will block them.
You can only have a popup if it is direct response to a user event (e.g. in an onclick handler).
You cannot trigger on at page load time.
I have used popup at many places in my website (its in PHP with Mysql DB and lots of javascript). These are mostly been blocked my browsers, which restricts user to move ahead. what should do in my code so that my popups becomes Popyp blocker independent..
Use Jquery Dialogs http://jqueryui.com/demos/dialog/ they are purely javascript and so popup blockers will not block this
Make sure your popups's URL is on the same domain as the main site. Using a link with 'target="_blank"' will never get blocked unless it was manually blocked as the user did the action himself. Switch to alerts and prompts instead of popups.
Not a direct answer but may be Floating div is a good replacement. Build a js dialog box.