Web Tool Bag  
Home · Articles · Downloads · Discussion Forum · Web Links · News Categories · Synonyms DatabaseOctober 20 2017 04:38:28
Navigation
Home
Articles
Downloads
Discussion Forum
Web Links
News Categories
Synonyms Database
Search
Users Online
Guests Online: 1
No Members Online

Registered Members: 856
Unactivated Members: 118
Newest Member: lakim
Forum Threads
Newest Threads
Uncaught Error: _reg...
Module build failed:...
Installation
mochi script questions
Redirect with captch...
Hottest Threads
Installation [12]
Any questions and... [5]
Captcha picture d... [4]
Integrate with Vi... [4]
Mods: Sucess/Than... [4]
 
Latest Articles
PHP Fatal error: Ca...
Mouse pointer disapp...
UBUNTU install via U...
Geany tried to acces...
How to create MySql ...
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)
{
 newwindow=window.open(url,'name','height=400,width=200');
 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.

height
    Defines the height of the window in pixels. Percentage values don't work.
width
    Defines the width. Again, you'll have no joy with percentages.
left
    Supported by version 4 browsers and above, this sets how far removed the window appears from the left of the screen. In pixels.
top
    Partner to left, this pushes the window off the top of the screen.
resizable
    Set to true or false, this may allow the user to resize the window.
scrollbars
    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.
toolbar
    Specifies whether the basic back/forward toolbar should be visible. If there are links to follow in your new page, set this to yes.
menubar
    Specifies whether the main toolbar (File, Edit, ...) is shown.
location
    Specifies whether the location toolbar (address bar) is shown.
status
    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.
directories
    Specifies whether the directories toolbar is shown (Links toolbar in IE).
fullscreen
    Internet Explorer-only Boolean attribute which may open the window in fullscreen. It's annoying — don't use it.
dependent
    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:

newwindow=window.open(url,'name','height=500,width=400,left=100,
  top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');


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.

Before:

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

After:

<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 11:41:58 16862 Reads · Print
Login
Username

Password



Not a member yet?
Click here to register.

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

Symfony

Zend

CodeIgniter

PHP on TRAX

eZ Components

Fusebox

PhpOpenbiz

Prado

QPHP

Seagull

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

Vince
03/10/2011 21: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

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

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

Copyright © 2017 - www.webtoolbag.com