Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Alert dialogue box in Javascript, or other...

  • 15-02-2007 01: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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 21,278 ✭✭✭✭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