How can a child browser window change the window's properties? - javascript

I'm working with a software package that creates Flash panorama .swf's. The package allows the creation of hotspots in the pano. You can specify the URL and the Target of the hotspot, so if you click on the hotspot it launches the URL in _blank, _self, etc.
However, the package doesn't allow you to specify the attributes of the window.
I'm trying to figure out if there's a way for the child window (once the swf opens it), to control it's own window attributes via Javascript.
I want to be able to control the size of the window and hide the address bar, status bar, etc.
One other issue that I need to deal with is this...I don't want the child window to open in a tab, but in a new smaller window...the only way that I've done this in the past is if the parent opens the child window and specify the size and that there are no menu bars and address bars. I'm not sure how to do that from the child window.

want to be able to control the size of the window and hide the address bar, status bar, etc.
You can maybe use window.resizeTo / window.resizeBy to resize the window. I'm saying "maybe" because some browsers will allow this only for windows opened through window.open().
You will not be able to get rid of the address bar and status bar in modern browsers any more for security reasons.
One other issue that I need to deal with is this...I don't want the child window to open in a tab, but in a new smaller window...the only way that I've done this in the past is if the parent opens the child window and specify the size and that there are no menu bars and address bars. I'm not sure how to do that from the child window.
This would amount to turning a "normal" window into a window.open popup window - I don't think that can be done at all.
Sadly, dealing with pop-up windows has become very restrictive because it has been abused so much.

Related

Open a window and share it among tabs?

I have a page that uses window.open() with a window name to pop up another window that will act as a presentation screen for my app:
window.open(url, 'my-presentation-win', 'resizable');
Now, that works well, and if I trigger that action, and then navigate to a different page, but then come back to the original page and trigger the action again, it brings the original popup window back into focus (the name is honored).
However, if I load the same HTML page in two different browser tabs (Chrome on OSX), and trigger that action in each, I end up with two different windows (each presumably with the name my-presentation-win?). Is there a way for that window to be re-used, when its used by the same app running in different tabs?
I don't think it's possible :(
Access a window by window name

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.

Opening a child window using Javascript that has navigation arrows and ability to add its own tabs

I am trying to open a bare bones window using window.open(), which is pretty basic and easy to do. I'm concerned here with Chrome running on Mac OSX.
My code:
window.open(url, "_account", "scrollbars, resizable");
A user asked me to add navigation controls (forward, back, reload), menu bar, status bar, and the ability to add new tabs from the child window... basically he wanted the window to behave like a "normal" browser window.
My code changed to:
window.open(url, "_account", "toolbar, scrollbars, resizable, menubar, location, status");
This was just me basically adding all of the options I could find to enable everything available. Yet this does not actually bring up the navigation controls or an address bar, or the 'new tab' button. When I checked mozilla's window.open() page, (especially the section describing the 'toolbar' option), I read this:
If this feature [toolbar] is on, then the new secondary window renders the Navigation Toolbar (Back, Forward, Reload, Stop buttons).
That sounds like it should have done exactly what I want, but I don't see those controls.
So, are child windows prevented by some unchangeable browser policy from having those controls? I don't see on that reference page how to add new tabs, address bar (that I can edit to go to a new location).
Thanks in advance.
(edited to address James's comment below)

Can I remove parent window when opening a new window?

I'm having an issue with a our main application's window activating itself when the mouse is hovered over it.
I'm opening the new window in a javascript function using the line below:
window.open(URL, 'Requests', 'location=no,toolbar=no,status=yes,scrollbars=yes,resizable=yes');
I have noticed that if I open a new IE window through Explorer, hovering over our main application's window does not reactivate itself. Even in this case though, the main window does make itself be "on top" of the pop-up window created by the window.open command above.
The question is this: Is there any way, when opening a "child" window in javascript, to detach the child window from the parent?
Further info: I am using an Infragistics WebDataMenu with ActivateOnHover set to true so users don't need to click on main menu items to see sub-menu choices. Unfortunately, that setting sensitizes the whole menu bar so that sliding the mouse through it activates the menu (and sadly the window when a popup is active). This is the root behavior I'm trying to fix.
The window.open(); method will create a popup window that really only shares a relationship through JavaScript via the return value of the call, and the window.opener property on the popup window.
What you want is the behavior of a modal window that locks out interaction from the 'parent' page while you work on the 'child' popup.
You can try to fight with JavaScript (and your users) by forcing a focus on the popup and blocking any blurring but this will drive users nuts when they want to go read their email etc. (eg not recommended)
You can also use the not so standard showModalDialog(); method but support is far from fully cross browser and there are a whole bunch of new problems if you try to use this (no right click in IE, zoom issues in IE, and no grandchildren popups to name a few) (again not recommended)
What you can do is make an "overlay" popup similar to many online photo viewers where you first overlay a mask (typically semi transparent) that blocks mouse/focus on the entire page content below and then overlay that with your "popup content". Just be sure that you provide a close option that removes the mask when the overlay is closed/done.
Note if you need to support IE6 you'll also need an iframe shim (Google if needed)
Many UI frameworks will provide a "dialog" just like this for you. (Eg jQueryUI)
Ultimately, I gave up on making this work. I found that what I had to do was turn off ActivateOnHover from the WebDataMenu, which didn't answer this question and requires users to click on the menu to make it drop down, but it became a work-around.

Can I programatically make my website go to full screen via F11?

I want to make my page viewed at full screen.
How can I programatically press F11 on page load. Is it possible?
Thank you
No - not possible without JavaScript. And only then, you can open a large new window, but not emulate pressing F11.
Also, changing browser window sizes without the user's consent is very frustrating for them.
It is not possible to open a window full screen on load. It is not possible to resize the page you are loading.
What you can do is to open a max size child window, say on click of a button etc (if you do it onload, popup blockers would block it).
If it is a corporate intranet then perhaps you can add a rule to all your browsers to add your site to the popup blicker whitelist.
You can also use flash (etc) to open a document full screen, but this is not probably what you are looking at.

Categories

Resources