I am noticing that my share popups are being blocked on our application but not others.
Here is the code execution:
1.) User enters web page.
2.) User clicks on facebook or twitter or googleplus share icon
3.) Onclick event passes the request to an internal controller that saves some information and then redirects back to the originating webpage. This time, however, there is a request parameter that invokes the usage of opening a new window.
The code I have that invokes opening a new window is (for this example we will use facebook):
var url = 'https://www.facebook.com/sharer/sharer.php?u='+copyLink;
window.open(url,'newwindow','width=600,height=600');
Now, if i enable popups it works fine. The problem is the user has to enable popups every time.
Is it a server issue? What is the reason why on other apps they don't have blocked popups but for OUR APP we cannot use popups without enabling popups
Any help would be greatly appreciated.
From what I understand, your application attempts to open a popup window following a page load. The nytimes.com popup appeared in response to a mouse click.
There is an important difference between these two ways to open a popup: the latter follows a user-initiated action but the former does not. As a result, popup blockers will generally block the former but not the latter. A lot of users wouldn't be too surprised if a popup opened when they clicked a button, but they would be more irritated if a popup appeared when a page loaded. The fact that your popup was ultimately triggered by an action on another page doesn't matter - what happens if you manually add to the URL the extra parameter that opens the popup?
Here's an old page on MSDN on popup blockers. It may describe the popup blocker in IE6 (of all browsers), but I think it still provides a reasonable explanation of when popup blockers typically permit or block popups.
Would it be possible to open a popup for your share dialog before calling back to the server? I would expect that opening a popup in the onclick handler would work without needing to explicitly allow popups.
Related
I am using software that creates all the HTML/XML so I don't have this and I have created a button to open a form in a new window. When I physically click on this button, everything works. However when I run the code onload, I get a message saying that the page is blocked and I need to remove any popup blocker
var button = getElement("GUID_of_Button");
button.click();
This code works if I set to open the form in the same window as a tooltip but not as a new window. I tried on Chrome, Firefox and IE with same results. (no console error)
Not sure if this helps (get this when I inspect element)
<input name="buttoncontrol0F09F8F7" id="ID_buttoncontrol0F09F8F7" value="Click here" type="submit" title="Click here" class="Button_Standard" style="cursor: pointer;">==$0
Naturally I can remove any blockers but as this is for the whole office, I can't ask everyone to do this just so I can get this to work. Any advise is appreciated.
This is a feature of modern browsers that restricts the opening of new windows to user-initiated actions.
This is important as it mitigate security risks and gets rid of the most obnoxious advertising.
Unless you can get everyone to change their browser settings, you won't have a new window opened automatically.
Depending on the data you need to display, you could consider alternative to new windows such as modals / pop-ins. Take a look for example at Bootstrap's modal.
Popup windows are generally used for advertisement and these windows will be opened without permission of user. Inorder to prevent this, most of the web browsers comes with popup blockers which should be explicitly configured by user if they want to automatically open something in a new window.
If you want to use this featue, you'll have to ask users to configure popup blockers in their web browser.
I created a simple JavaScript function to display my pop-up window once it loads. But it keeps on being blocked by Firefox and Google Chrome and I have to somehow enable it on the Firefox and Chrome to display the pop-up.
Are there any alternatives for this?
I have a player on the pop-up window so I have to use a pop-up to let the player play automatically. The problem is that if I put it on the page itself, once the user clicks another page the entire page reloads and the player automatically stops for a few seconds until the whole page reloads and I have to prevent this from happening.
The general rule is that popup blockers will engage if window.open or similar is invoked from javascript that is not invoked by direct user action. That is, you can call window.open in response to a button click without getting hit by the popup blocker, but if you put the same code in a timer event it will be blocked. Depth of call chain is also a factor - some older browsers only look at the immediate caller, newer browsers can backtrack a little to see if the caller's caller was a mouse click etc. Keep it as shallow as you can to avoid the popup blockers.
Please take a look at dthorpe's answer here. It covers your question.
You could try putting the player on the original page, and using something like History.js to control page changes (you could have the main page body in one wrapper div that changes, and leave the player outside of it).
Otherwise, you could try (assuming you meant a HTML5 <video> or <audio> player) downloading the data to localStorage/cookie/[other persistent storage mechanism] and have it seek everytime you change a page.
It will be hard to stop browsers from blocking your pop up window, because any way to do so is inherently exploitable; however, if you call the function to open another window from an onclick event, you may be able to circumvent some popup blockers. Also, some popup blockers allow popups when using the https protocol, although not many have this feature, and https can be hard to implement for the average website, if you don't have physical access to the server.
One other option is to open the other page in another tab (like this w3c example; you can 'click' the link with javascript).
You might also want to look at this post, as it is somewhat similar.
I only just discovered you asked this question.
Here's the answer in full.
Basically, you can simply create the popup immediately as the user event is fired, then fill it with content (your player, for instance) as you have it available.
Hi I have set up a task in my task scheduler to login to my UTM by opening a firefox window at regular intervals. When the relevant URL is loaded a auto-login GM script works on it and logs me in to UTM.
I would like to close that tab after the login is done. If I use
window.close();
It works fine but if no other tab is opened at the time, it simply closes the window.
Without going into details of UTM I would like the following -
A GM hack which closes the tab only if other tabs are already open. If it is the last tab of the window, then it should just replace it with a blank tab (so that window is not closed).
Probably GM cannot obtain any info about the other tabs, but is there any hack ?
As far as I'm aware this isn't possible, if nothing else then for security reasons: you don't spam javascript from your video streaming tab collecting all your data and submitting forms on your behalf.
Here's a thread with a solution that worked for IE7 that you may be able to manipulate but as I said it's not likely.
If you decide to have ago, don't think about identifying the number of tabs, it won't happen, instead focus on determining whether or not there are multiple tabs.
The linked example uses if(clientY == 0) to determine whether or not the browser is closing. This would be a good starting point.
Again, for security reasons, you won't be able to find out information about open tabs.
I want to allow popups when site loads and if the root cause of an event is NOT a physical click by the user, then it's getting blocked. any help
My code:
$("#buttonBtn").on('click',function(){
openpopup('temp'+id)
});
$("#buttonBtn").trigger('click');
Thanks in advance
With this, if you explicitly click, popup appears. If user comes to this button via keyboard and press Enter or something, I guess this would not be triggered.
$("#buttonBtn").click(function(e){
e.preventDefault();
// some job you will do if clicked, for example, open popup
});
Great example here
You can generally open popups by using window.open. However, most browsers have built-in popup blocker where the user will be notified about a popup and will be asked if he really wants to show it.
The MDN has an informative article about window.open. It also gives some information about popup blockers:
How can I tell when my window was blocked by a popup blocker?
With the
built-in popup blockers of Mozilla/Firefox and Internet Explorer 6
SP2, you have to check the return value of window.open(): it will be
null if the window wasn't allowed to open. However, for most other
popup blockers, there is no reliable way.
Source: https://developer.mozilla.org/en-US/docs/DOM/window.open
I'm developing a Google Chrome extension with a popup (it's a browser action), and it changes the location of the page, which makes the popup disappear. How can I make it stay between page reloads?
You can't. browserAction popups are closed on any activity outside of the popup. You could potentially use Desktop Notifications though.
You'll need to use Background Page, and pull information from it every time you load the popup. Background pages run whether or your extension is currently being used or not.
Not sure if this helps, but from the FAQ:
Can extensions keep popups open after the user clicks away from them?
No, popups automatically close when the user focuses on some portion of the browser outside of the popup. There is no way to keep the popup open after the user has clicked away.
I had to implement a workaround for this as well. In my case, I was trying to use auth0's loginWithPopup. When the popup closed, it returned focus to the chrome window instead of the extension which caused the extension to close before authorization fully completed. I worked around it by opening a new window which acts as a barrier of sorts to prevent chrome's focus from going back to the window the extension was opened from. Anyway, just wanted to put it out there in case it helps someone in the future.