Resize window etc to look like a pop-up

Discussion in 'Javascript' started by Nigel Mercier ®, Aug 17, 2003.

  1. I'm just starting to learn JavaScript, so far I like it!

    I want to add some JS to my Ebay listings, to manually open a pop-up
    window. It works OK, but the JS gets rejected by Ebay.

    If I can't use JS in my listing, is there a way of using JS to resize a
    current window, and remove the toolbars etc, so it looks like a pop-up?


    --
    Nigel Mercier

    Please remove NOSPAM from my return address
     
    Nigel Mercier ®, Aug 17, 2003
    #1
    1. Advertising

  2. Nigel Mercier ® wrote:


    > I want to add some JS to my Ebay listings, to manually open a pop-up
    > window. It works OK, but the JS gets rejected by Ebay.
    >
    > If I can't use JS in my listing, is there a way of using JS to resize a
    > current window


    Yes... but its very annoying and is blocked by most decent browsers.

    >, and remove the toolbars etc, so it looks like a pop-up?


    No.

    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Aug 17, 2003
    #2
    1. Advertising

  3. In comp.lang.javascript, David Dorward wrote:
    >[resize windows] very annoying and is blocked by most decent browsers.


    Perhaps I should mention that I want to open a new window when the user
    clicks a link, and it's that window that I want to resize etc.

    Failing that, is there a way to make the document.close() method work
    without bringing up a warning prompt? I could then use an intermediate
    window to launch the pop up.

    Any other suggestions welcome.


    --
    Nigel Mercier

    Please remove NOSPAM from my return address
     
    Nigel Mercier ®, Aug 17, 2003
    #3
  4. While the city slept, Nigel Mercier ® <>
    feverishly typed:

    > In comp.lang.javascript, David Dorward wrote:
    >> [resize windows] very annoying and is blocked by most decent
    >> browsers.

    >
    > Perhaps I should mention that I want to open a new window when the
    > user clicks a link, and it's that window that I want to resize etc.
    >
    > Failing that, is there a way to make the document.close() method work
    > without bringing up a warning prompt? I could then use an intermediate
    > window to launch the pop up.
    >
    > Any other suggestions welcome.


    I think it's time for someone to read the FAQ's:
    http://www.jibbering.com/faq

    Cheers,
    Nige

    --
    Nigel Moss.

    Email address is not valid. . Take the dog out!
    http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
    "How strange the change from major to minor..."
     
    nice.guy.nige, Aug 17, 2003
    #4
  5. DU wrote:

    > Rather than resize an already created and opened requested popup, why
    > not set the window dimensions for such window before creating it.


    Becuase, as the OP stated in his initial post, Ebay filters JavaScript out.
    So the page with the link on it can't include a window.open. Any scripting
    has to be done on the page linked too.

    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Aug 17, 2003
    #5
  6. In comp.lang.javascript, Nigel Mercier ® wrote:

    >That's the problem, I can't use JS on the initial page, see OP.


    Sorry, sent this before I meant to <rummage: finds glasses>

    I realize that I haven't given you kind folks enough info, so here is
    the code that I wanted to use on Ebay, but I can't because they don't
    allow JS.


    <script LANGUAGE="javascript">

    function openIt()
    {
    window.open('http://homepage.virgin.net/hosting.services/ebay/ppfees.htm',
    'fred', config='height=180,width=400');
    }

    </SCRIPT>

    <a href="javascript:eek:nClick=openIt()">Click here to open a
    calculator</a>

    --
    Nigel Mercier

    Please remove NOSPAM from my return address
     
    Nigel Mercier ®, Aug 17, 2003
    #6
  7. Nigel Mercier ®

    Jim Ley Guest

    On 17 Aug 2003 17:55:11 GMT, (HikksNotAtHome)
    wrote:

    >In article <bhocdd$1fp97$-berlin.de>, "nice.guy.nige"
    ><> writes:
    >
    >>
    >>I think it's time for someone to read the FAQ's:
    >>http://www.jibbering.com/faq

    >
    >Agreed, but, with respect to closing windows that js didn't open, the FAQ is
    >utterly wrong.


    Because of browser bugs you mean? or something else?

    Jim.
    --
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Jim Ley, Aug 17, 2003
    #7
  8. Nigel Mercier ®

    Jim Ley Guest

    On 17 Aug 2003 18:21:27 GMT, (HikksNotAtHome)
    wrote:

    >In article <>, (Jim Ley)
    >writes:
    >
    >>Because of browser bugs you mean? or something else?

    >
    >It may indeed be a bug, but if it is, then its a very
    >very wide spread one.


    It's still a bug, (as in, works in violation of the documented
    behaviour of those browsers)

    Jim.
    --
    comp.lang.javascript FAQ - http://jibbering.com/faq/
     
    Jim Ley, Aug 17, 2003
    #8
  9. Nigel Mercier ®

    DU Guest

    David Dorward wrote:

    > DU wrote:
    >
    >
    >>Rather than resize an already created and opened requested popup, why
    >>not set the window dimensions for such window before creating it.

    >
    >
    > Becuase, as the OP stated in his initial post, Ebay filters JavaScript out.
    > So the page with the link on it can't include a window.open. Any scripting
    > has to be done on the page linked too.
    >


    Thanks for the clarification. I did not know that and did not quite
    understood the "JS gets rejected by Ebay" part of the OP initial post
    ..... thought it was JS functions not working.

    The problem is that Mozilla-based browser users can disable resizeTo and
    moveTo calls. I personally do this to prevent abuse and I recommend
    people to not give a single chance to resizeTo and moveTo methods:
    scripters should never be relying on these methods.

    In any case, as long as the new window/requested popup is resizable and
    has scrollbars if needed, the initial window dimensions and positions
    are not that important.

    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
    - Resources, help and tips for Netscape 7.x users and Composer
    - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
    http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
     
    DU, Aug 17, 2003
    #9
  10. Nigel Mercier ®

    DU Guest

    HikksNotAtHome wrote:

    > In article <>, (Jim Ley)
    > writes:
    >
    >
    >>Because of browser bugs you mean? or something else?
    >>
    >>Jim.

    >
    >
    > http://tinyurl.com/kaez
    > and links therein.
    >
    > Shows the results of this script:
    >
    > window.opener = window;
    > window.close();
    >


    I also tested
    window.opener = "fred";
    window.close();

    and Mozilla 1.4, 1.5b and NS 7.1 will report a conversion error
    (NS_ERROR_XPC_BAD_CONVERT_JS).


    > It may indeed be a bug, but if it is, then its a very very wide spread one.
    >
    > Netscape 4.06 - Prompts the user about trying to close a window (I didn't see
    > this message, someone else tested it for me).
    > Netscape 4.80 - closes window without a prompt.
    > IE5.0 - prompts the user.
    > IE5.5 - closes the window without a prompt.
    > IE6.0 - closes the window without a prompt.
    > Netscape 7 - closes the window without a prompt.


    NS 7.1 does not close the window.

    > Opera 7 - closes the window without a prompt.


    Opera 7.20b3 closes the page (active tab) without a prompt. Amazing...

    > Opera 6.05 - closes the window without a prompt.
    > Phoenix 0.5 - closes the window without a prompt.
    > Mozilla 1.4 - No prompt, just an error message "Scripts may not close windows
    > that were not opened by script." in the Javascript console.
    >


    Mozilla 1.5b does not close the window.

    > Netscape, Opera and other "tabbed" browsers, it doesn't close the entire
    > browser,
    > just the active tab (if its set to use tabs).
    >
    >
    > MAC browsers:
    >
    > AOL For Mac OSX v. 10.3 - closes the window without a prompt.
    > IE 5.2.2 for Mac - closes the window without a prompt.
    > omniWeb on MacOSX - closes the window without a prompt.
    >
    > Netscape 7.02 for Mac OSX Does nothing, and after attempting to open,
    > Netscape must be rebooted
    >
    > The MAC testing wasn't done by me, so not sure exactly how they work.
    >
    >


    I personally do not like to see scripters being able to close windows
    not opened by javascript. This can and would definitively lead to abuse,
    malicious scripts, etc..

    DU
    --
    Javascript and Browser bugs:
    http://www10.brinkster.com/doctorunclear/
    - Resources, help and tips for Netscape 7.x users and Composer
    - Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
    http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
     
    DU, Aug 17, 2003
    #10
  11. Nigel Mercier ®

    Grant Wagner Guest

    "Nigel Mercier ®" wrote:

    > In comp.lang.javascript, Nigel Mercier ® wrote:
    >
    > >That's the problem, I can't use JS on the initial page, see OP.

    >
    > Sorry, sent this before I meant to <rummage: finds glasses>
    >
    > I realize that I haven't given you kind folks enough info, so here is
    > the code that I wanted to use on Ebay, but I can't because they don't
    > allow JS.
    >
    > <script LANGUAGE="javascript">
    >
    > function openIt()
    > {
    > window.open('http://homepage.virgin.net/hosting.services/ebay/ppfees.htm',
    > 'fred', config='height=180,width=400');
    > }
    >
    > </SCRIPT>
    >
    > <a href="javascript:eek:nClick=openIt()">Click here to open a
    > calculator</a>
    >
    > --
    > Nigel Mercier


    Your JavaScript is completely wrong, and that's most likely the reason it's
    not working on eBay.

    window.open() takes 3 parameters, the first is the URL, the second is the name
    of the window, the 3rd is a comma-delimited list of attributes to be applied
    to the window. The phrase "config=" shouldn't appear anywhere in an open()
    method invocation.

    I'd suggest before attempting to use JavaScript on a service like eBay, you
    actually learn the basics of scripting first, either locally or on the
    webspace provided by your ISP.

    <script type="text/javascript">
    function openIt(url, name, attributes) {
    window.open(url, name, attributes);
    }
    </script>

    <a href="http://host/path/file.html"
    target="fred"
    onclick="openIt(this.href, this.name, 'height=180,width=400'); return
    false;">Link</a>

    Now, if JavaScript is enabled you will get a window with your choice of width
    and height. If JavaScript is disabled or filtered by a proxy, the link will
    (should) still produce a new window with your URL loaded into it. I say
    "should" because some browsers can be configured so that even TARGET="..." is
    ignored and the link is opened in the current browser window.

    By the way, I don't believe eBay does anything to script embedded in ads. I
    remember a recent eBay posting that used script to open your CDROM drive door,
    so I don't believe they filter it (although since that incident they may have
    started filtering it). Regardless, I /know/ your script contained errors, so
    that's the first place to start.

    --
    | Grant Wagner <>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    *
    http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

    * Internet Explorer DOM Reference available at:
    *
    http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

    * Netscape 6/7 DOM Reference available at:
    * http://www.mozilla.org/docs/dom/domref/
    * Tips for upgrading JavaScript for Netscape 7 / Mozilla
    * http://www.mozilla.org/docs/web-developer/upgrade_2.html
     
    Grant Wagner, Aug 19, 2003
    #11
  12. In comp.lang.javascript, Grant Wagner wrote:

    >our JavaScript is completely wrong, and that's most likely the reason it's
    >not working on eBay.


    It works just fine thanks, just not on Ebay (they don't allow it).

    >I'd suggest before attempting to use JavaScript on a service like eBay, you
    >actually learn the basics of scripting first


    Thanks for your very kind and helpful encouragement.


    --
    Nigel Mercier

    Please remove NOSPAM from my return address
     
    Nigel Mercier ®, Aug 19, 2003
    #12
  13. Grant Wagner <> writes:

    > "Nigel Mercier ®" wrote:


    > > <script LANGUAGE="javascript">
    > > function openIt()
    > > {
    > > window.open('http://homepage.virgin.net/hosting.services/ebay/ppfees.htm',
    > > 'fred', config='height=180,width=400');
    > > }
    > > </SCRIPT>
    > >
    > > <a href="javascript:eek:nClick=openIt()">Click here to open a
    > > calculator</a>


    > Your JavaScript is completely wrong, and that's most likely the reason it's
    > not working on eBay.


    Not completely wrong. It is syntactically correct and should work as
    expected in most browsers. It just has some unnecessary additions
    ("config=", "onClick=") that looks like black magic ("I'll add this, I
    don't know why!"). They probably won't hurt, but they sure don't do
    anything good either.

    Apart from that, your suggestions are good. Remove the "magic words",
    change the javascript: href to an onclick event handler, and change
    the "language" attribute to a "type" attribute.

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Aug 19, 2003
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    0
    Views:
    422
  2. Kevin Walzer

    Re: PIL (etc etc etc) on OS X

    Kevin Walzer, Aug 1, 2008, in forum: Python
    Replies:
    4
    Views:
    451
    Fredrik Lundh
    Aug 13, 2008
  3. active
    Replies:
    4
    Views:
    314
    active
    Apr 3, 2007
  4. Replies:
    2
    Views:
    126
    Thomas 'PointedEars' Lahn
    Nov 13, 2003
  5. Madame Blablavatsky
    Replies:
    8
    Views:
    205
    Dr John Stockton
    Sep 16, 2005
Loading...

Share This Page