Parent window highlight in taskbar / bring to front - javascript

I have a web page where certain links open up a popup window, now if a user is about to be loggedout out we show a jquery layer stating that.
now if he user is still on the popup for a long time he never sees the log out layer and is then automatically logged out
Is there a way to
1.Highlight the main window in the taskbar so the user can take notice and go there
2.Bring the window to the front
We do not want to show any mesage in the popup window
We also do not want to use html5 notifications for now
Also cannot use alert() but need to replicate the behaviour of alert when my layer shows

Related

Tampermonkey script --After SWITCHING to a new tab from an old one, push an alert to the new one

I'm running a tampermonkey script on chrome.
What I want:
If a user starts off at an old tab, say google.com, and they go to another tab, I want to alert the user something.
Problem is, my alert currently only pops up on the google tab (THE OLD TAB), but now the user isn't on the google tab, they're on the other tab.
So they don't actually see the alert pop up, making it useless. Is there a way to pop the alert on the tab currently in focus (aka the new tab you navigated to from the google tab) or on all tabs in the browser window? Also, the solution will have to NOT include matching all possible url's on the internet.
IF the solution pops an alert on all tabs in the browser window, it should also be that clicking "okay" will dismiss all the alerts in each tab).
I've been using the window.onblur function to know whether the user switches tabs from the old tab to another, and it fires. Again, the problem is the alert pops up on the tab that the user does not see
$(window).on('blur',function () {
alert("You switched tabs");
// do some stuff after tab was changed e.g.
})
You can communicate between tabs with GM_setValue() and GM_getValue(). You can set your current url as value on blur and run a loop (with setInterval()) to get the value and look if it changed/alert based on its content.
It is not possible to dismiss alerts in other tabs.

I want to make a popup which does not allows user to close browser until popup closes

I want to make popup which freezes the browser until the popup is closed. But I am stuck at a point since on closing the browser, it is asking the user to stay or leave but when a user clicks on leave it shuts down. I instead want a that when a user clicks the leave option it either reload the site or do nothing, also on doing the same for second time Chrome is giving alert to prevent any additional dialogue which I want to disable or it should do nothing. Until the popup is closed. So at last users should not be able to close their browser from a closing button of browser or by going back or replacing the URL. It should freeze until the requirement of the popup is fulfilled. Thank you and please help.
You can't force the users to stay on your site as the browser doesn't allow this (think of a malicious site forcing you to stay there). Your approach is probably the best you can do. Show a dialog that says something like. "Please wait while exiting..." or similar.
If you want to hide the "Block additional dialogs from this page" thing you can create your own dialog. Just a div with position: fixed and display: none and then onBeforeUnload show it with display: block.
Here is more on that: Stackoverflow.com
In that case you can use bootstrap popup:
like this:
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_modal&stacked=h
and on the click event on close button you can add new alert or some other popup..
and closing this type of popup box cannot reflect other data..
It might helps you.!

how to pop-out, pop-in iframes like Gmail hangout

Pop-out a chat windows (using iframe) to new tab then pop-in it to get it back to the windows ..like Google does with they hangout chat windows in Gmail web.
I have been googling but could figure it out. Maybe my knowledge is not good enough
i mean that you want to say when you click in the arrow into the box, then is opening a popup with the chat.
I'm not sure that google do this, but is a way to do the same effect for the user.
When you click there, there open a pop up, the procediment to do this is the next;
you create a function in JS with window.open() this opens a window
If you want to open a page inside the window you have to specified it
window.open("chat.php")
the method open allows 3 parameters
window.open(document,name of the window,attributes of the window)
Document
Uri of the doccument to be loaded into the popup.
Name of the window
Identified for the window, you can do references to this id after is opened.
Attributes of the window
A couple of name/value to assign different options for this widow, there are:
Width (of the window in pixels)
height (of the window in pixels)
top : position of the window starting on the top
left: position of the window starting on the left
toolbar, if you want to show the toolbar or not (boolean)
status, if you want to show the status bar (boolean)
location, if you want to show the location bar.
directories, if you want to show the personal bar.
scrollbars, if you want to show the scrollbar
menubar if you want to show the menubar
this is a example of how to open a new window :
function openPopUp(){
newpopup = window.open('chat.html/user1=xxxx?user2=yyyy','newwindow','width=300, height=400')
}
the back-end of this page is going to load the chat between the user 1 and 2.
now to go back to the parent window.
you can return a value then when you click in the arrow to go back, they should be something in the onclick function like
function returnPopUp(){
top.close();
return "user1=xxxx?user2=yyyy"
}
then they load the frame in the parent window again.
and as I told you before, something similar for the newpopup close listener.
Thanks.

How can I make a tool-tip to automatically appear for my chrome extension which uses pageaction?

I want to have a message displayed automatically, whenever my pageaction icon is displayed.
How can I make that to be displayed, I want to alert the user that " You can click this button to perform so on....".
If you want a popup appear programmatically, this cannot be done, it can only be initiated by a user click.
It would be nice if you could use infobars API, but it is still experimental.
Therefore, your only choice seems to be to inject a script into the page that would create some sort of overlay on the page roughly pointing to the page action area.
Note that you will need permission to access that page, as activeTab permission is not enabled until user clicks on your page action.

How facebook/twitter share buttons avoid being blocked by popup blockers?

When a user which is not logged in to Facebook or Twitter, clicks the like/tweet button, a popup comes up asking the user to log in. This popup is not blocked by popup blockers of any kind. in IE for example, it opens up but anyway IE state a warning to the user. The bottom line is that all buttons probably use the same method.
I have a button that people click on it and it should open a similar screen, but it always gets blocked.
The button (in JS) works pretty much like FB like button. It checks if the user is logged in. If he does, then send the "like" to the servers. If he does not, then the login popup appears (and gets blocked).
So, it is a initiated by a user although not fully direct outcome, since we need to check if he logged in or not.
What is best method to do that?
The Popup Is activated by a click using the like, tweet button and they actually show only 1 popup. If you want, you can try by using only a single popup based on click for your website and you will definitely be able to understand this.

Categories

Resources