SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question how to notify user to enable java script if disabled?

    i wanted to put a js popup link,
    but it is dead when js disabled.

  2. #2
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One option is to use <noscript>

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by webdev1958 View Post
    One option is to use <noscript>
    There are some technical reasons why using the noscript tag is not a good idea for example, some user agents just ignore the tag, it'll be no good if scripting is enabled but scripts are blocked by a firewall, and technically the noscript tag is invalid, so your validation will fail too.

    Better is just to place a unique identifier on the message, and then use scripting to hide that message.

    In terms of the js popup link, use an ordinary link to the popup, so that non-scripted people can still access it, and use scripting to override the default behaviour of the link so that it opens as a popup instead.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    In terms of the js popup link, use an ordinary link to the popup, so that non-scripted people can still access it, and use scripting to override the default behaviour of the link so that it opens as a popup instead.
    ordinary link to the popup!!!
    how to do that?

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by mazhar1986 View Post
    ordinary link to the popup!!!
    how to do that?
    Use the second parameter of the window.open command to specify the name of the window in which the link should be opened.
    window.open(strUrl, strWindowName[, strWindowFeatures]);


    As it says on the documentation page: "If a window with the name strWindowName already exists, then strUrl is loaded into the existing window."

    For example:

    Code javascript:
    window.open('http://www.google.com', 'popupWindow', 'width=200,height=100');
    Last edited by paul_wilkins; Nov 18, 2011 at 03:15.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by webdev1958 View Post
    One option is to use <noscript>
    thnx 4 the quick reply,

    this option is good,
    but i'm looking for someway that the popup link will be automatically replaced by another normal link!!!

    is that possible?

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by mazhar1986 View Post
    thnx 4 the quick reply,

    this option is good,
    but i'm looking for someway that the popup link will be automatically replaced by another normal link!!!

    is that possible?
    It's difficult to interpret what you require, so let's use some key words.

    The main web page is called the parent window, and the popup page will be the child window.

    What is it that you want? Is it that when someone clicks a link in the parent window, that that link is loaded in the child window replacing what was there?
    Because if so, that's easily achieved by using the same name for the child window, and for each of the window.open commands to load a link in to that child window.

    Or, is it that you want the link on the parent window to open up in the child window, and for the parent window link to be replaced by a different type of link?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •