Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Alert dialogue box in Javascript, or other...

Options
  • 15-02-2007 1:53pm
    #1
    Closed Accounts Posts: 29


    Hiya,

    I want to create a java script alert box that activates when a user clicks on an external link. It should function something like

    "The page you have requested is outside boards.ie Click OK if you wish to visit the new site, or Cancel if you wish to return to boards.ie."

    I know there is a way to do this, and I'm just going round in circles....

    Doesn't necessarily need to be javascript, just as long as it functions!

    Thanks
    Speeds


Comments

  • Registered Users Posts: 273 ✭✭stipey


    Look at the confirm function in JavaScript

    http://www.devguru.com/technologies/javascript/10884.asp

    Obviously this will be tied into the OnClick event of the link or button.


  • Registered Users Posts: 1,127 ✭✭✭smcelhinney


    Good idea, however...

    Consider that Google page ranking relies on the amount of outbound and inbound links on your site to relevant sites in the same category as yours. If you then put event driven obstacles (such as javascript onclicks) in the way, then there's invariably a downside to this; less external links, lower page ranks, less clicks to your site.

    What you could do is use foot notes or title tags for your hrefs. For example, rolling over a link can provide you with a text equivalent. See code below
    <a href="www.boards.ie" title="Link to boards: Note, clicking on this link will take you to an external site, which we are not responsible for, blah blah">www.boards.ie</a>
    

    It doesn't quite achieve the same thing, but there are several usability concerns for using your javascript example. Also, its not accessible to screenreaders.

    HTH,
    Stephen


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    I think you can also use CSS to automatically add a little image to links that go to an external site. I'll try and dig the code out.

    Edit: here's the link:
    http://www.askthecssguy.com/2006/12/showing_hyperlink_cues_with_cs_1.html


Advertisement