Web Tool Bag  
Home · Articles · Downloads · Discussion Forum · Web Links · News Categories · Synonyms DatabaseJuly 18 2024 05:52:30
Discussion Forum
Web Links
News Categories
Synonyms Database
Users Online
Guests Online: 1
No Members Online

Registered Members: 856
Unactivated Members: 118
Newest Member: lakim
Forum Threads
Newest Threads
Error: Cannot find m...
Uncaught Error: _reg...
Module build failed:...
mochi script questions
Hottest Threads
Installation [12]
Any questions and... [5]
Captcha picture d... [4]
Integrate with Vi... [4]
Mods: Sucess/Than... [4]
Latest Articles
Ubuntu: the vpn conn...
Howto Install HP Pri...
ReactJS progress met...
Open a new window in firefox

Source of article: http://www.yourhtmlsource.com

Open a new window in firefox   

Opening a new window is a popular way of letting your users see additional information
without navigating away from the current page. With JavaScript you can specify the dimensions,
position and visible toolbars of this newly created window, as well as writing code directly into
it and having the two windows operating together.

Open a new window in firefox

Is there a method to open a new window from a pop up window in FireFox?

Right now, I have this window that pops up. In there are a few links that I'd like to open in a normal Firefox window
(a new one or as a tab from where the pop up originated). But, the problem is, even if I use target = _blank or target = newpage,
I end up opening a tab inside that popup window itself. Which is really funny.

Not even target _blank works.

Privileged scripts (ie. the ones running in extensions and other chrome) can add and remove tabs, but I don't believe the gBrowser object is available to unprivileged scripts.

That being said there are scripting techniques that my satisfy your needs. Here are a couple of html documents. Copy them and save them to the same directory,
name them test.html and test2.html respectively. Then open test.html in your browser.

The first has a link that runs code to open a new window without window chrome. The child window has two links, one that opens a third window,
one that redirects the parent window. Note that it WILL NOT open a new tab in the parent window. Security features withing FF only allow the child to
see and talk to the parent that opened it (ie. the tab with test.html).

Opening New Windows

Opening new windows is easy enough in plain old HTML, using the target attribute on your links, like so:

<a href="example.html" mce_href="example.html" target="_blank">link text</a>

This will open the new page in a new window, and is perfect for most people’s needs. However, if you want more control over this new window,
you will need to use some JavaScript code. To get a rudimentary page to pop up off your main page on command from a link,
you'll need the following JavaScript code and JavaScript link:

var newwindow;
function poptastic(url)
 if (window.focus) {newwindow.focus()}

<a href="javascript:poptastic('poppedexample.html');" mce_href="javascript:poptastic('poppedexample.html');">Pop it</a>

We're simply defining a new JavaScript function, which we can pass different URLs to each time. This will open the specified url in a new, downsized window,
the dimensions of which are set down in the function. Try it here: » Pop it

The HTML for that link simply called the function with the URL of the page we want to pop up as an argument. It looks like this:

<a href="javascript:poptastic('/examples/poppedexample.html');" mce_href="javascript:poptastic('/examples/poppedexample.html');">Pop it</a>

We load the new window (created with the window.open() method) into a variable. This method then takes three arguments: the address of the new page,
the name of the window, and a third argument which can hold some, few, or less optional attributes of the window, such as the height and width which I've
defined in this case.

The url we're using is passed to the function when we call it, so that this function can be used for any number of different popups (though the height/width
and other options will always be the same unless you modify the function to take more arguments). Some browsers prohibit the opening of pages on another
server for security reasons, so test your script. The name we specify will be used to open further pages into this new window.
The Arguments

You have a number of options for the third argument. When you define any of them, the remaining Boolean values (which can be true/false or yes/no or 1/0)
are all set to false/no/0. Whichever you choose to use, all of your options go into the same quoted string, with commas between the values, and no spaces
are allowed between them.

    Defines the height of the window in pixels. Percentage values don't work.
    Defines the width. Again, you'll have no joy with percentages.
    Supported by version 4 browsers and above, this sets how far removed the window appears from the left of the screen. In pixels.
    Partner to left, this pushes the window off the top of the screen.
    Set to true or false, this may allow the user to resize the window.
    Another Boolean value, this adds scrollbars to the new window. If your content may be longer then the dimensions you've specified, make sure this is set to yes.
    Specifies whether the basic back/forward toolbar should be visible. If there are links to follow in your new page, set this to yes.
    Specifies whether the main toolbar (File, Edit, ...) is shown.
    Specifies whether the location toolbar (address bar) is shown.
    Specifies whether the new window can have a status bar. Best set to yes. For security reasons, Mozilla-based browsers always show the status bar.
    Specifies whether the directories toolbar is shown (Links toolbar in IE).
    Internet Explorer-only Boolean attribute which may open the window in fullscreen. It's annoying — don't use it.
    Netscape 4-only attribute which makes the popup dependent on the status of the main window. If the main window is closed, the popup closes with it.
screenX & screenY
    Old Netscape attributes for defining the window's position on the page. Use left and top in their place.

So, a fully kitted-out new window might look more like this:


A New Relationship

The HTML 4.0 specification took away the target attribute, but it added another attribute: rel.
This attribute is intended to specify the relationship between the document that contains the link,
and the target of the link. The specification defines a bunch of standard values for this attribute
(e.g. next, previous, chapter, section), most of which have to do with relationships between small sections
of a larger document. However, the spec leaves the developer free to use nonstandard values for site-specific purposes.

Here at SitePoint, we have adopted a custom value for the rel attribute to mark links leading to other Websites.
These are the very same links that we want to open in a new browser window. For these links, we set the rel attribute to external.


<a href="document.html" mce_href="document.html" target="_blank">external link</a>


<a href="document.html" mce_href="document.html" rel="external">external link</a>

So, now that we have our new-window links marked up in a standards-compliant way, we need to write
the JavaScript that will cause them to actually open in a new window.

All courses following 220-601 and 642-382 are easy, once you have already done 642-812 or even 642-825. This is why students prefer doing 646-203 before going for 650-251.

Source of article: http://www.yourhtmlsource.com

Posted by admin on January 04 2008 09:41:58 20188 Reads · Print


Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Member Poll
Which PHP framework do you preffer?





eZ Components






You must login to vote.
You must login to post a message.

03/10/2011 18:17
Hi, How to remove Register from Login screen? I don't want them to register and have full access! if you leave register then they should not have any rights until the admin assigns them

26/09/2011 08:28
Please describe your problem with more details. Thank you.

22/11/2010 18:31
Help. There was a problem with the request; error regarding feedbackzdr form program

Custom web software development by Devzone Tech
Copyright © 2024 - www.webtoolbag.com