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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting url-protocols

Status
Not open for further replies.

cpfc

Programmer
Aug 4, 2003
23
GB
Hi,
I've made my own protocol named "test1:"
I've made it so that if you type "test1:" in Internet explorer's address bar notepad opens.

On my web page I have the following code:

Code:
<script language=&quot;javascript&quot;>
<!-- 
function OpenNotepad()
{
	navigate(&quot;test1:&quot;);
}
-->
</script>

<p><a href=&quot;javascript:OpenNotepad()&quot;>Notepad</a>


Code works fine on my computer, but it's the only computer in the world with the protocol “test1”.
Just before calling navigate, how do I make it detect if the protocol &quot;test1&quot; exists or not? Then I could easily make it redirect to my &quot;error.html&quot; page if it doesn't.

Hope that makes sense, help would be appreciated and thanks in advance...
 
Sure, it can be done. But not with client side JS.

I'd suggest searching Msoft's site for JScript Protocol.

Regards,
Trope
 
Humn, if you opened a test:// link in a frame could you make it so the resulting document sends a value to a script in the referral page?

If so, and if the value isn't returned, JS knows the document never loaded.

Client side JS is sandboxed, and rightly so. For security reasons it cannot query things outside it's intended environment.

----------
I'm willing to trade custom scripts for... [see profile]
 
Thanks for replies...
Seeing as the resulting document is notepad I doubt it's possible to send a value to a script in the referral page.
Fair enough, javascript is protected from attackers, but how can you attack a computer with a few functions to query whether protocols exist?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top