Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

warning on leaving intranet 2

Status
Not open for further replies.

Rydel

Programmer
Feb 5, 2001
376
CZ
I am designing an Intranet for a company and I would like to have an automatic warning dialog whenever there is a link outside of our intranet ( to an outside resource ( and user clicks on it. Of course, I can create "onclick" handler for all links, but this is too cumbersome and difficult to maintain. tt would be much better if there was a generic way to issue this warning "once and for all". All Intranet users have IE5.0 or IE5.5 (what a blessing! ;)) Any help greatly appreciated! ---
---
 
What you want is a DHTML behavior ( that uses AttachEvent ( to attach an onclick event handler to every hyperlink in the document automatically and can perform a short check on the Event.srcElement.href ( property, and if the property doesn't meet the criteria for an intranet page, you activate a popup with the onbeforeunload event, which can send any warning you want to the user before the browser navigates to the next page. Check out
(Enough links for ya?) This can all be done from a single external file, with the extension .htc, which is referenced from a style declaration at the top of the page. Once you get the hang of it, DHTML behaviors can be a useful programming tool for IE-specific intranets.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top