[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

window.open allowing image to scale

Andrew Poulos

6/3/2014 3:12:00 AM

I need to be able to popup a window to enable users to see the image
they've selected. The simplest way I thought of using was to point
window.open to the image itself.

This works but the image will rescale (at least it does in IE 9) if the
popup window is resized to smaller than the image's "natural" size:

var myPop = window.open(
"images/puzzle.jpg",
"",
"width=240,height=320,resizable,status=0"
);


Is there a way to keep the image from scaling?

Andrew Poulos
16 Answers

Andrew Poulos

6/3/2014 3:20:00 AM

0

On 3/06/2014 1:11 PM, Andrew Poulos wrote:
> I need to be able to popup a window to enable users to see the image
> they've selected. The simplest way I thought of using was to point
> window.open to the image itself.
>
> This works but the image will rescale (at least it does in IE 9) if the
> popup window is resized to smaller than the image's "natural" size:
>
> var myPop = window.open(
> "images/puzzle.jpg",
> "",
> "width=240,height=320,resizable,status=0"
> );
>
>
> Is there a way to keep the image from scaling?

To answer my own question, I just did this

var myPop = window.open("","","width=240,height=320,resizable,status=0);
myPop.document.open();
myPop.document.write("<img src='images/puzzle.jpg' alt=''>");
myPop.document.close();

and the image now doesn't scale when the window is made smaller than the
image.

Andrew Poulos

Evertjan.

6/3/2014 6:55:00 AM

0

Andrew Poulos <ap_prog@hotmail.com> wrote on 03 jun 2014 in
comp.lang.javascript:

> On 3/06/2014 1:11 PM, Andrew Poulos wrote:
>> I need to be able to popup a window to enable users to see the image
>> they've selected. The simplest way I thought of using was to point
>> window.open to the image itself.
>>
>> This works but the image will rescale (at least it does in IE 9) if the
>> popup window is resized to smaller than the image's "natural" size:
>>
>> var myPop = window.open(
>> "images/puzzle.jpg",
>> "",
>> "width=240,height=320,resizable,status=0"

It should be: resizable=1

>> );
>>
>>
>> Is there a way to keep the image from scaling?
>
> To answer my own question, I just did this
>
> var myPop = window.open("","","width=240,height=320,resizable,status=0);
> myPop.document.open();

this .document.open() is not needed, it is implicit.

> myPop.document.write("<img src='images/puzzle.jpg' alt=''>");
> myPop.document.close();

this .document.close() is not needed,
unless you want a second .document.write()
to overwrite the document by inducing the implicit .open()

> and the image now doesn't scale when the window is made smaller than the
> image.

Okay.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Andrew Poulos

6/3/2014 8:39:00 AM

0

On 3/06/2014 4:55 PM, Evertjan. wrote:
> Andrew Poulos <ap_prog@hotmail.com> wrote on 03 jun 2014 in
> comp.lang.javascript:
>
>> On 3/06/2014 1:11 PM, Andrew Poulos wrote:
>>> I need to be able to popup a window to enable users to see the
>>> image they've selected. The simplest way I thought of using was
>>> to point window.open to the image itself.
>>>
>>> This works but the image will rescale (at least it does in IE 9)
>>> if the popup window is resized to smaller than the image's
>>> "natural" size:
>>>
>>> var myPop = window.open( "images/puzzle.jpg", "",
>>> "width=240,height=320,resizable,status=0"
>
> It should be: resizable=1

<https://developer.mozilla.org/en-US/docs/Web/API/Windo...
says that

"NOTE: All features can be set to yes, 1 or just be present to
be 'on', set to no or 0 or in most cases just not present to be 'off'
example 'status=yes', 'status=1' and 'status' have identical results".

Does that note apply only to toolbar and chrome features and not to
window functionality features?

Andrew Poulos

Evertjan.

6/3/2014 8:59:00 AM

0

Andrew Poulos <ap_prog@hotmail.com> wrote on 03 jun 2014 in
comp.lang.javascript:

> <https://developer.mozilla.org/en-US/docs/Web/API/Windo...
> says that
>
> "NOTE: All features can be set to yes, 1 or just be present to
> be 'on', set to no or 0 or in most cases just not present to be 'off'
> example 'status=yes', 'status=1' and 'status' have identical results".
>
> Does that note apply only to toolbar and chrome features and not to
> window functionality features?

I seem to remember the original [non-mozilla?] spec was different.

Perhaps the default "1" is cross-browser proven.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Thomas 'PointedEars' Lahn

6/4/2014 9:29:00 AM

0

Evertjan. wrote:

> Andrew Poulos <ap_prog@hotmail.com> wrote on 03 jun 2014 in
> comp.lang.javascript:

It is called attribution *line*, _not_ attribution novel.

>> To answer my own question, I just did this
>>
>> var myPop = window.open("","","width=240,height=320,resizable,status=0);
>> myPop.document.open();
>
> this .document.open() is not needed, it is implicit.

Only with HTML5:

<http://www.w3.org/TR/2014/CR-html5-20140204/webappapis.html#dom-document...

vs.

<http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-75...

>> myPop.document.write("<img src='images/puzzle.jpg' alt=''>");
>> myPop.document.close();
>
> this .document.close() is not needed,

Wrong. Because a script-created parser has no information about whether
further content will be generated by script, the explicit document.close()
is necessary to close the input stream for a document *created* with
scripting. Otherwise that document will load forever, and indicate that to
the user by â??waitâ?-shape pointer cursor.

<http://www.w3.org/TR/2014/CR-html5-20140204/webappapis.html#dynamic-markup-ins...

> unless you want a second .document.write()
> to overwrite the document by inducing the implicit .open()

No, a second document.write() call will send further content to the same
input stream unless it has been closed.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Evertjan.

6/4/2014 1:02:00 PM

0

Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 04 jun 2014 in
comp.lang.javascript:

>> unless you want a second .document.write()
>> to overwrite the document by inducing the implicit .open()
>
> No, a second document.write() call will send further content to the same
> input stream unless it has been closed.

It seems reading English is difficult for you, Thomas.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Thomas 'PointedEars' Lahn

6/4/2014 1:17:00 PM

0

Evertjan. wrote:

> Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 04 jun 2014 in
> comp.lang.javascript:

Will you ever learn?

>>> unless you want a second .document.write()
>>> to overwrite the document by inducing the implicit .open()
>>
>> No, a second document.write() call will send further content to the same
>> input stream unless it has been closed.
>
> It seems reading English is difficult for you, Thomas.

Your statement

>>> this .document.close() is not needed,
>>> unless you want a second .document.write()
>>> to overwrite the document by inducing the implicit .open()

is wrong. document.close() is needed here in any case. document.write()
does not necessarily â??induce the implicit .open()â?. And obviously it makes
no sense at all to issue a document.close() followed by a document.write().

IOW, you have been writing nonsense. So much for understanding English.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

John Harris

6/4/2014 1:48:00 PM

0

On Wed, 04 Jun 2014 11:28:41 +0200, Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote:

>Evertjan. wrote:
>
>> Andrew Poulos <ap_prog@hotmail.com> wrote on 03 jun 2014 in
>> comp.lang.javascript:
>
>It is called attribution *line*, _not_ attribution novel.
<snip>

It is 85 characters long, has been wrapped by the automation, and
is completely inoffensive. It is a pseudo-header that obeys all
the standards for headers.

On the other hand, the header
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
is an antisocial header used by a frequent poster to this news group.

John

Evertjan.

6/4/2014 2:51:00 PM

0

Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 04 jun 2014 in
comp.lang.javascript:

> Evertjan. wrote:
>
>> Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote on 04 jun 2014 in
>> comp.lang.javascript:
>
> Will you ever learn?
>
>>>> unless you want a second .document.write()
>>>> to overwrite the document by inducing the implicit .open()
>>>
>>> No, a second document.write() call will send further content to the
>>> same input stream unless it has been closed.
>>
>> It seems reading English is difficult for you, Thomas.
>
> Your statement
>
>>>> this .document.close() is not needed,
>>>> unless you want a second .document.write()
>>>> to overwrite the document by inducing the implicit .open()
>
> is wrong. document.close() is needed here in any case.
> document.write() does not necessarily â??induce the implicit .open()â?.

No, but a prior document.close() does, as I wrote.

> And obviously it makes no sense at all to issue a document.close()
> followed by a document.close().

Perhaps to you, because you did not read correctly.
It is not the point if it makes sense, I described what happens.
Your postings often don't make sense, but thet are sent by you anyway.

However, as the document.close() before a document.write()
induces an implicit document.open(), it can be a way to
clear the window for new html.

Obviously this makes some more sense, perhaps not to you,
when the destination is not the window the script is "on",
but not exclusively so.

> IOW, you have been writing nonsense. So much for understanding English.

The first, quod non, does not imply
that your understanding is that good, quod non,
your "obviously" already hinted at that, Thomas.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Christoph M. Becker

6/4/2014 3:36:00 PM

0

John Harris wrote:

> On Wed, 04 Jun 2014 11:28:41 +0200, Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote:
>
> On the other hand, the header
> Face: [snipped content]
> is an antisocial header used by a frequent poster to this news group.

Why is it "antisocial"?

--
Christoph M. Becker