Hyperlink Control

Discussion in 'ASP .Net' started by =?Utf-8?B?c2NrMTA=?=, Oct 21, 2004.

  1. Hello,

    Can you control the window attributes (toolbar, scrollbars, left and right
    exc.) when using the hyperlink control as you would when using javascript?

    For examle, I am using the following javascript to open another window and
    would like to control these attributes with the hyperlink control:
    window.open(msgSubmitterInfo,t,s);return false"
    var s="toolbar=no,directories=no,scrollbars=yes,resizable=yes,";
    s+= "left=200,top=100,width=500,height=400";

    --
    Thanks in advance,
    sck10
    =?Utf-8?B?c2NrMTA=?=, Oct 21, 2004
    #1
    1. Advertising

  2. Those aren't attributes; they're parameters, which are passed to the
    JavaScript window.open() method. Now, you certainly CAN make the URL of a
    hyperlink point to a JavaScript method call:

    <a href="javascript:window.open(...)">Click Here</a>

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living

    "sck10" <> wrote in message
    news:...
    > Hello,
    >
    > Can you control the window attributes (toolbar, scrollbars, left and right
    > exc.) when using the hyperlink control as you would when using javascript?
    >
    > For examle, I am using the following javascript to open another window and
    > would like to control these attributes with the hyperlink control:
    > window.open(msgSubmitterInfo,t,s);return false"
    > var s="toolbar=no,directories=no,scrollbars=yes,resizable=yes,";
    > s+= "left=200,top=100,width=500,height=400";
    >
    > --
    > Thanks in advance,
    > sck10
    Kevin Spencer, Oct 21, 2004
    #2
    1. Advertising

  3. Kevin, along these lines, is there any other way to insert code into an href
    without using the "javascript:"? I am allowing users to define certain links
    in my system, and want to make sure I filter out anything that might be
    malicious. Thanks.

    "Kevin Spencer" wrote:

    > Those aren't attributes; they're parameters, which are passed to the
    > JavaScript window.open() method. Now, you certainly CAN make the URL of a
    > hyperlink point to a JavaScript method call:
    >
    > <a href="javascript:window.open(...)">Click Here</a>
    >
    > --
    > HTH,
    > Kevin Spencer
    > ..Net Developer
    > Microsoft MVP
    > I get paid good money to
    > solve puzzles for a living
    >
    > "sck10" <> wrote in message
    > news:...
    > > Hello,
    > >
    > > Can you control the window attributes (toolbar, scrollbars, left and right
    > > exc.) when using the hyperlink control as you would when using javascript?
    > >
    > > For examle, I am using the following javascript to open another window and
    > > would like to control these attributes with the hyperlink control:
    > > window.open(msgSubmitterInfo,t,s);return false"
    > > var s="toolbar=no,directories=no,scrollbars=yes,resizable=yes,";
    > > s+= "left=200,top=100,width=500,height=400";
    > >
    > > --
    > > Thanks in advance,
    > > sck10

    >
    >
    >
    =?Utf-8?B?QmlsbCBCb3Jn?=, Oct 21, 2004
    #3
  4. > Kevin, along these lines, is there any other way to insert code into an
    href
    > without using the "javascript:"?


    Afraid not, Bill. You'll have to think of a secure way of doing what you
    want. If you want JavaScript in hyperlinks, you will get JavaScript in
    hyperlinks. The "javascript:" has nothing to do with it, other than
    informing the browser that the hyperlink is to a JavaScript function, rather
    than to an HTTP URL.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living

    "Bill Borg" <> wrote in message
    news:...
    > Kevin, along these lines, is there any other way to insert code into an

    href
    > without using the "javascript:"? I am allowing users to define certain

    links
    > in my system, and want to make sure I filter out anything that might be
    > malicious. Thanks.
    >
    > "Kevin Spencer" wrote:
    >
    > > Those aren't attributes; they're parameters, which are passed to the
    > > JavaScript window.open() method. Now, you certainly CAN make the URL of

    a
    > > hyperlink point to a JavaScript method call:
    > >
    > > <a href="javascript:window.open(...)">Click Here</a>
    > >
    > > --
    > > HTH,
    > > Kevin Spencer
    > > ..Net Developer
    > > Microsoft MVP
    > > I get paid good money to
    > > solve puzzles for a living
    > >
    > > "sck10" <> wrote in message
    > > news:...
    > > > Hello,
    > > >
    > > > Can you control the window attributes (toolbar, scrollbars, left and

    right
    > > > exc.) when using the hyperlink control as you would when using

    javascript?
    > > >
    > > > For examle, I am using the following javascript to open another window

    and
    > > > would like to control these attributes with the hyperlink control:
    > > > window.open(msgSubmitterInfo,t,s);return false"
    > > > var s="toolbar=no,directories=no,scrollbars=yes,resizable=yes,";
    > > > s+= "left=200,top=100,width=500,height=400";
    > > >
    > > > --
    > > > Thanks in advance,
    > > > sck10

    > >
    > >
    > >
    Kevin Spencer, Oct 21, 2004
    #4
  5. If I understand you right, I think that's a good thing. Aren't you saying
    that if the "javascript:" is not there the browser won't try to "run" it, in
    which case I can just exclude any user-defined links that include
    "javascript" (e.g. I just remove the word and let the browser give a 404 when
    somebody clicks on that "link")?

    "Kevin Spencer" wrote:

    > > Kevin, along these lines, is there any other way to insert code into an

    > href
    > > without using the "javascript:"?

    >
    > Afraid not, Bill. You'll have to think of a secure way of doing what you
    > want. If you want JavaScript in hyperlinks, you will get JavaScript in
    > hyperlinks. The "javascript:" has nothing to do with it, other than
    > informing the browser that the hyperlink is to a JavaScript function, rather
    > than to an HTTP URL.
    >
    > --
    > HTH,
    > Kevin Spencer
    > ..Net Developer
    > Microsoft MVP
    > I get paid good money to
    > solve puzzles for a living
    >
    > "Bill Borg" <> wrote in message
    > news:...
    > > Kevin, along these lines, is there any other way to insert code into an

    > href
    > > without using the "javascript:"? I am allowing users to define certain

    > links
    > > in my system, and want to make sure I filter out anything that might be
    > > malicious. Thanks.
    > >
    > > "Kevin Spencer" wrote:
    > >
    > > > Those aren't attributes; they're parameters, which are passed to the
    > > > JavaScript window.open() method. Now, you certainly CAN make the URL of

    > a
    > > > hyperlink point to a JavaScript method call:
    > > >
    > > > <a href="javascript:window.open(...)">Click Here</a>
    > > >
    > > > --
    > > > HTH,
    > > > Kevin Spencer
    > > > ..Net Developer
    > > > Microsoft MVP
    > > > I get paid good money to
    > > > solve puzzles for a living
    > > >
    > > > "sck10" <> wrote in message
    > > > news:...
    > > > > Hello,
    > > > >
    > > > > Can you control the window attributes (toolbar, scrollbars, left and

    > right
    > > > > exc.) when using the hyperlink control as you would when using

    > javascript?
    > > > >
    > > > > For examle, I am using the following javascript to open another window

    > and
    > > > > would like to control these attributes with the hyperlink control:
    > > > > window.open(msgSubmitterInfo,t,s);return false"
    > > > > var s="toolbar=no,directories=no,scrollbars=yes,resizable=yes,";
    > > > > s+= "left=200,top=100,width=500,height=400";
    > > > >
    > > > > --
    > > > > Thanks in advance,
    > > > > sck10
    > > >
    > > >
    > > >

    >
    >
    >
    =?Utf-8?B?QmlsbCBCb3Jn?=, Oct 21, 2004
    #5
  6. Hi Bill,

    > If I understand you right, I think that's a good thing. Aren't you saying
    > that if the "javascript:" is not there the browser won't try to "run" it,

    in
    > which case I can just exclude any user-defined links that include
    > "javascript" (e.g. I just remove the word and let the browser give a 404

    when
    > somebody clicks on that "link")?


    Correct, as long as we're talking about the href of a hyperlink. Make sure
    that they can't add any "onclick" attributes, though, as that would be able
    to call JavScript without the "javascript:".

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living

    "Bill Borg" <> wrote in message
    news:...
    > If I understand you right, I think that's a good thing. Aren't you saying
    > that if the "javascript:" is not there the browser won't try to "run" it,

    in
    > which case I can just exclude any user-defined links that include
    > "javascript" (e.g. I just remove the word and let the browser give a 404

    when
    > somebody clicks on that "link")?
    >
    > "Kevin Spencer" wrote:
    >
    > > > Kevin, along these lines, is there any other way to insert code into

    an
    > > href
    > > > without using the "javascript:"?

    > >
    > > Afraid not, Bill. You'll have to think of a secure way of doing what you
    > > want. If you want JavaScript in hyperlinks, you will get JavaScript in
    > > hyperlinks. The "javascript:" has nothing to do with it, other than
    > > informing the browser that the hyperlink is to a JavaScript function,

    rather
    > > than to an HTTP URL.
    > >
    > > --
    > > HTH,
    > > Kevin Spencer
    > > ..Net Developer
    > > Microsoft MVP
    > > I get paid good money to
    > > solve puzzles for a living
    > >
    > > "Bill Borg" <> wrote in message
    > > news:...
    > > > Kevin, along these lines, is there any other way to insert code into

    an
    > > href
    > > > without using the "javascript:"? I am allowing users to define certain

    > > links
    > > > in my system, and want to make sure I filter out anything that might

    be
    > > > malicious. Thanks.
    > > >
    > > > "Kevin Spencer" wrote:
    > > >
    > > > > Those aren't attributes; they're parameters, which are passed to the
    > > > > JavaScript window.open() method. Now, you certainly CAN make the URL

    of
    > > a
    > > > > hyperlink point to a JavaScript method call:
    > > > >
    > > > > <a href="javascript:window.open(...)">Click Here</a>
    > > > >
    > > > > --
    > > > > HTH,
    > > > > Kevin Spencer
    > > > > ..Net Developer
    > > > > Microsoft MVP
    > > > > I get paid good money to
    > > > > solve puzzles for a living
    > > > >
    > > > > "sck10" <> wrote in message
    > > > > news:...
    > > > > > Hello,
    > > > > >
    > > > > > Can you control the window attributes (toolbar, scrollbars, left

    and
    > > right
    > > > > > exc.) when using the hyperlink control as you would when using

    > > javascript?
    > > > > >
    > > > > > For examle, I am using the following javascript to open another

    window
    > > and
    > > > > > would like to control these attributes with the hyperlink control:
    > > > > > window.open(msgSubmitterInfo,t,s);return false"
    > > > > > var s="toolbar=no,directories=no,scrollbars=yes,resizable=yes,";
    > > > > > s+= "left=200,top=100,width=500,height=400";
    > > > > >
    > > > > > --
    > > > > > Thanks in advance,
    > > > > > sck10
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
    Kevin Spencer, Oct 21, 2004
    #6
  7. Got it, thanks.

    "Kevin Spencer" wrote:

    > Hi Bill,
    >
    > > If I understand you right, I think that's a good thing. Aren't you saying
    > > that if the "javascript:" is not there the browser won't try to "run" it,

    > in
    > > which case I can just exclude any user-defined links that include
    > > "javascript" (e.g. I just remove the word and let the browser give a 404

    > when
    > > somebody clicks on that "link")?

    >
    > Correct, as long as we're talking about the href of a hyperlink. Make sure
    > that they can't add any "onclick" attributes, though, as that would be able
    > to call JavScript without the "javascript:".
    >
    > --
    > HTH,
    > Kevin Spencer
    > ..Net Developer
    > Microsoft MVP
    > I get paid good money to
    > solve puzzles for a living
    >
    > "Bill Borg" <> wrote in message
    > news:...
    > > If I understand you right, I think that's a good thing. Aren't you saying
    > > that if the "javascript:" is not there the browser won't try to "run" it,

    > in
    > > which case I can just exclude any user-defined links that include
    > > "javascript" (e.g. I just remove the word and let the browser give a 404

    > when
    > > somebody clicks on that "link")?
    > >
    > > "Kevin Spencer" wrote:
    > >
    > > > > Kevin, along these lines, is there any other way to insert code into

    > an
    > > > href
    > > > > without using the "javascript:"?
    > > >
    > > > Afraid not, Bill. You'll have to think of a secure way of doing what you
    > > > want. If you want JavaScript in hyperlinks, you will get JavaScript in
    > > > hyperlinks. The "javascript:" has nothing to do with it, other than
    > > > informing the browser that the hyperlink is to a JavaScript function,

    > rather
    > > > than to an HTTP URL.
    > > >
    > > > --
    > > > HTH,
    > > > Kevin Spencer
    > > > ..Net Developer
    > > > Microsoft MVP
    > > > I get paid good money to
    > > > solve puzzles for a living
    > > >
    > > > "Bill Borg" <> wrote in message
    > > > news:...
    > > > > Kevin, along these lines, is there any other way to insert code into

    > an
    > > > href
    > > > > without using the "javascript:"? I am allowing users to define certain
    > > > links
    > > > > in my system, and want to make sure I filter out anything that might

    > be
    > > > > malicious. Thanks.
    > > > >
    > > > > "Kevin Spencer" wrote:
    > > > >
    > > > > > Those aren't attributes; they're parameters, which are passed to the
    > > > > > JavaScript window.open() method. Now, you certainly CAN make the URL

    > of
    > > > a
    > > > > > hyperlink point to a JavaScript method call:
    > > > > >
    > > > > > <a href="javascript:window.open(...)">Click Here</a>
    > > > > >
    > > > > > --
    > > > > > HTH,
    > > > > > Kevin Spencer
    > > > > > ..Net Developer
    > > > > > Microsoft MVP
    > > > > > I get paid good money to
    > > > > > solve puzzles for a living
    > > > > >
    > > > > > "sck10" <> wrote in message
    > > > > > news:...
    > > > > > > Hello,
    > > > > > >
    > > > > > > Can you control the window attributes (toolbar, scrollbars, left

    > and
    > > > right
    > > > > > > exc.) when using the hyperlink control as you would when using
    > > > javascript?
    > > > > > >
    > > > > > > For examle, I am using the following javascript to open another

    > window
    > > > and
    > > > > > > would like to control these attributes with the hyperlink control:
    > > > > > > window.open(msgSubmitterInfo,t,s);return false"
    > > > > > > var s="toolbar=no,directories=no,scrollbars=yes,resizable=yes,";
    > > > > > > s+= "left=200,top=100,width=500,height=400";
    > > > > > >
    > > > > > > --
    > > > > > > Thanks in advance,
    > > > > > > sck10
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
    =?Utf-8?B?QmlsbCBCb3Jn?=, Oct 21, 2004
    #7
    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. Arjen
    Replies:
    0
    Views:
    517
    Arjen
    Aug 4, 2003
  2. davetichenor
    Replies:
    1
    Views:
    821
    Eliyahu Goldin
    Oct 30, 2006
  3. =?Utf-8?B?Y2dhbWJpbm8=?=

    Hyperlink control in user control

    =?Utf-8?B?Y2dhbWJpbm8=?=, Mar 22, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    359
    GroupReader
    Mar 22, 2007
  4. Ken
    Replies:
    1
    Views:
    372
    Alvin Bruney
    Aug 16, 2003
  5. Dave
    Replies:
    0
    Views:
    935
Loading...

Share This Page