473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Determine whether a URI scheme is enabled

I'm curious. I'd like to determine whether a particular URI scheme (the
"ftp:", "news:", "http:" part) is available within the user's browser.

For example, consider this HTML snippet:

Telephone us on <a href="tel:+44113393xxxx">0113 393-xxxx</a>

I could extend the tag with an onClick handler that displayed an
alert() box (or similar), but ideally I'd like it only to do that if
the underlying URI scheme couldn't be handled by the user's browser.

Thanks,
Chris
Oct 3 '07 #1
4 2622
On Oct 3, 9:11 am, Chris Davies <chris-use...@roaima.co.ukwrote:
I'm curious. I'd like to determine whether a particular URI scheme (the
"ftp:", "news:", "http:" part) is available within the user's browser.

For example, consider this HTML snippet:

Telephone us on <a href="tel:+44113393xxxx">0113 393-xxxx</a>

I could extend the tag with an onClick handler that displayed an
alert() box (or similar), but ideally I'd like it only to do that if
the underlying URI scheme couldn't be handled by the user's browser.
You are out of luck there.

Oct 3 '07 #2
Chris Davies wrote:
I'm curious. I'd like to determine whether a particular URI scheme (the
"ftp:", "news:", "http:" part) is available within the user's browser.

I could extend the tag with an onClick handler that displayed an alert()
box (or similar), but ideally I'd like it only to do that if the underlying
URI scheme couldn't be handled by the user's browser.
You can do something along

function navigateTo(s)
{
try
{
window.location = s;
}
catch (e)
{
window.alert("Unsupported URI scheme: " + s.match(/^[^:]+/));
}

return false;
}

<a href="foo:bar" onclick="return navigateTo(this.href);">...</a>

But you can't suppress an error message displayed by the UA already.
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Oct 3 '07 #3
Chris Davies wrote:
I'm curious. I'd like to determine whether a particular URI scheme (the
"ftp:", "news:", "http:" part) is available within the user's browser.
Thomas 'PointedEars' Lahn <Po*********@web.dewrote:
You can do something along
function navigateTo(s)
{
try
{
window.location = s;
}
catch (e)
{
window.alert("Unsupported URI scheme: " + s.match(/^[^:]+/));
}
In FF the "No program for this URI scheme" error (paraphrased) can't be
caught like this, so sadly I'm no better off.

Thanks for the thought.
Chris
Oct 5 '07 #4
Chris Davies wrote:
Chris Davies wrote:
>I'm curious. I'd like to determine whether a particular URI scheme (the
"ftp:", "news:", "http:" part) is available within the user's browser.

Thomas 'PointedEars' Lahn <Po*********@web.dewrote:
>You can do something along
Please read the FAQ on how to quote correctly in Usenet.
> function navigateTo(s)
{
try
{
window.location = s;
}
catch (e)
{
window.alert("Unsupported URI scheme: " + s.match(/^[^:]+/));
}

In FF the "No program for this URI scheme" error (paraphrased) can't be
caught like this,
It can be considered a great advantage here to be capable of reading.

| But you can't suppress an error message displayed by the UA already.
so sadly I'm no better off.
As I said: you can't do this.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Oct 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dave | last post by:
How do I programatically read the enabled or disabled status of accounts? Have read the msdn article: http://msdn.microsoft.com/library/default.asp? url=/library/en-...
3
by: dave | last post by:
How do I programatically determine the enabled or disabled status of AD accounts? I have queried the userAccountControl key, but all I get back is an int, and it seems to be the same for enabled...
1
by: Steve Murphy | last post by:
How do you determine whether JavaScript is enabled from your C# code on the server-side? Thanks.
0
by: Benjamin Bittner | last post by:
hallo ng, first of all, for the zipping progress i use the ziplib from http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx now to my problem. im trying to build a little application...
2
by: Johannes | last post by:
When you do a webrequest like: Dim objWebRequest As WebRequest = WebRequest.Create(objURI) the returned class can be httpwebrequest, ftpwebrequest or any othe descendant webrequest type that is...
3
by: balakrishnan.dinesh | last post by:
hi frnds How to determine the version of the MSXML installed on a computer and How to determine the version of the MSXML used by Internet Explorer through javascript code. Can anyone say me ,...
2
by: christian.eickhoff | last post by:
Hello Everyone, I am facing a problem which should be relatively easy to solve for XML or XERCES experts. I am parsing my XML instance using xerces-c SAXParser. For internal purposes, it is...
5
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
Is there any way to do the following: 1. Determine whether ClearType is enabled by the system (under Display Properties - Effects in WinXP). 2. Determine whether a font supports ClearType. ...
8
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I want to determine the Windows color scheme that is being used by my app. This means that I need to determine the following: 1. Does the OS support themes? 2. Are themes currently enabled...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.