Passing parameters to a custom URI

user182944

I have a custom uri like this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Demo]
@="URL:Demo Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\Demo\DefaultIcon]
@="\"D:\\demo.bat\""

[HKEY_CLASSES_ROOT\Demo\shell]

[HKEY_CLASSES_ROOT\Demo\shell\open]

[HKEY_CLASSES_ROOT\Demo\shell\open\command]
@="\"D:\\demo.bat\" \"%1\" \"%2\" \"%3\" \"%4\""

For running this from the command prompt, I use this command:

D:\demo.bat -ping -ip 172.18.102.65

But for running the same from browser, if I use the custom URI as Demo: then it is asking me to pass the parameters. I am not aware of how to pass the parameters to the custom URI if I run it form the browser.

How to pass the parameters while running this custom uri from browser? Please advise.

Remy Lebeau

When using a custom URL, the entire URL is passed to the registered app/script as a single parameter. Your app/script needs to parse the URL to extract what it needs. For example:

[HKEY_CLASSES_ROOT\Demo\shell\open\command]
@="\"D:\\demo.bat\" \"%1\""

You can format the URL any way you want, as long as it is a valid URL and begins with demo:, eg:

D:\demo.bat "demo:ping?ip=172.18.102.65"

D:\demo.bat "demo:ping=172.18.102.65"

D:\demo.bat "demo:ping%20172.18.102.65"

Update: Note, however, that this only works with Internet Explorer (and Windows Explorer, and tbe Windows Shell). You need another solution for other browsers. For instance, Firefox has its own Protocol Handler mechanisms:

Web-based protocol handlers

Adding a New Protocol to Mozilla

Writing a Firefox Protocol Handler

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Passing parameters to a custom URI

分類Dev

Passing parameters to corb uri stage using ml-gradle

分類Dev

Passing arguments / parameters from a Google sheets custom function to the script function

分類Dev

Passing parameters to middleware in Laravel

分類Dev

Passing parameters to AngularJS $timeout

分類Dev

Passing LINQ expressions as parameters

分類Dev

Passing parameters to jest function

分類Dev

Passing parameters to a OPENQUERY

分類Dev

passing BlocProvider with class parameters

分類Dev

Passing parameters to a react component

分類Dev

Error with passing parameters

分類Dev

Maple passing parameters by reference

分類Dev

Iframe not passing url parameters

分類Dev

Custom URI using javascript

分類Dev

Regex: Match Optional URI Parameters

分類Dev

Golang: Passing structs as parameters of a function

分類Dev

Passing additional parameters to MapStruct mapper

分類Dev

Passing parameters in rmarkdown to the text or headings

分類Dev

Passing parameters to scalameta paradise macro

分類Dev

Angular 6 passing in parameters into URL

分類Dev

Passing parameters in java script function ?

分類Dev

Adding custom parameters to a widget

分類Dev

Passing parameter to custom Gradle task

分類Dev

Passing custom method from custom class to .map

分類Dev

Laravel 4 - URI Parameters in Implicit Controllers

分類Dev

Passing list of enum values as HTTP query parameters

分類Dev

Passing parameters through Ajax success function

分類Dev

Passing list of enum values as HTTP query parameters

分類Dev

Unpacking a dictionary and passing to a function as keyword parameters

Related 関連記事

ホットタグ

アーカイブ