diff --git a/Makefile b/Makefile
index dd41dac..06fda31 100644
--- a/Makefile
+++ b/Makefile
@@ -203,7 +203,6 @@ install-common:
install -m 0755 misc/qubes-session-autostart $(DESTDIR)/usr/bin/qubes-session-autostart
install qubes-rpc/{qvm-open-in-dvm,qvm-open-in-vm,qvm-copy-to-vm,qvm-move-to-vm,qvm-run,qvm-mru-entry} $(DESTDIR)/usr/bin
- install qubes-rpc/wrap-in-html-if-url.sh $(DESTDIR)$(LIBDIR)/qubes
install qubes-rpc/qvm-copy-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
install qubes-rpc/qvm-copy-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
install qubes-rpc/qvm-move-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
@@ -222,6 +221,7 @@ install-common:
install -m 0644 qubes-rpc/{qvm-copy.desktop,qvm-move.desktop,qvm-dvm.desktop} $(DESTDIR)/$(KDESERVICEDIR)
install -d $(DESTDIR)/etc/qubes-rpc
install -m 0644 qubes-rpc/{qubes.Filecopy,qubes.OpenInVM,qubes.VMShell,qubes.SyncNtpClock} $(DESTDIR)/etc/qubes-rpc
+ install -m 0755 qubes-rpc/qubes.OpenURL $(DESTDIR)/etc/qubes-rpc
install -m 0644 qubes-rpc/{qubes.SuspendPre,qubes.SuspendPost,qubes.GetAppmenus} $(DESTDIR)/etc/qubes-rpc
install -m 0755 qubes-rpc/qubes.SuspendPreAll $(DESTDIR)/etc/qubes-rpc
install -m 0755 qubes-rpc/qubes.SuspendPostAll $(DESTDIR)/etc/qubes-rpc
diff --git a/qubes-rpc/qubes.OpenURL b/qubes-rpc/qubes.OpenURL
new file mode 100755
index 0000000..17daa2b
--- /dev/null
+++ b/qubes-rpc/qubes.OpenURL
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+read url
+
+case "$url" in
+ http://*|\
+ https://*|\
+ ftp://*)
+ exec qubes-open "$url"
+ ;;
+ *)
+ echo "Invalid URL" >&2
+ exit 1
+ ;;
+esac
+
diff --git a/qubes-rpc/qvm-open-in-dvm b/qubes-rpc/qvm-open-in-dvm
index 12669a9..3a01cdf 100755
--- a/qubes-rpc/qvm-open-in-dvm
+++ b/qubes-rpc/qvm-open-in-dvm
@@ -25,7 +25,4 @@ if ! [ $# = 1 ] ; then
exit 1
fi
-. /usr/lib/qubes/wrap-in-html-if-url.sh
-wrap_in_html_if_url "$1"
-
-exec /usr/lib/qubes/qrexec-client-vm '$dispvm' qubes.OpenInVM "/usr/lib/qubes/qopen-in-vm" "$FILE_ARGUMENT"
+exec qvm-open-in-vm '$dispvm' "$1"
diff --git a/qubes-rpc/qvm-open-in-vm b/qubes-rpc/qvm-open-in-vm
index 4c650f5..d109e6b 100755
--- a/qubes-rpc/qvm-open-in-vm
+++ b/qubes-rpc/qvm-open-in-vm
@@ -24,6 +24,12 @@ if ! [ $# = 2 ] ; then
echo "Usage: $0 vmname filename"
exit 1
fi
-. /usr/lib/qubes/wrap-in-html-if-url.sh
-wrap_in_html_if_url "$2"
-exec /usr/lib/qubes/qrexec-client-vm "$1" qubes.OpenInVM "/usr/lib/qubes/qopen-in-vm" "$FILE_ARGUMENT"
+
+case "$2" in
+ *://*)
+ exec /usr/lib/qubes/qrexec-client-vm "$1" qubes.OpenURL /bin/echo "$2"
+ ;;
+ *)
+ exec /usr/lib/qubes/qrexec-client-vm "$1" qubes.OpenInVM "/usr/lib/qubes/qopen-in-vm" "$2"
+ ;;
+esac
diff --git a/qubes-rpc/wrap-in-html-if-url.sh b/qubes-rpc/wrap-in-html-if-url.sh
deleted file mode 100644
index e5a91b3..0000000
--- a/qubes-rpc/wrap-in-html-if-url.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-wrap_in_html_if_url()
-{
- case "$1" in
- *://*)
- FILE_ARGUMENT=$(mktemp)
-
- echo -n ''
- echo -n '/\>/g; s/"/\"/g; s/'"'"'/\'/g' >> $FILE_ARGUMENT
- echo '"/>' >> $FILE_ARGUMENT
- ;;
- *)
- FILE_ARGUMENT="$1"
- ;;
- esac
-}
-
diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec
index f000554..5a2aab0 100644
--- a/rpm_spec/core-vm.spec
+++ b/rpm_spec/core-vm.spec
@@ -333,6 +333,7 @@ rm -f %{name}-%{version}
%dir /etc/qubes-rpc
%config(noreplace) /etc/qubes-rpc/qubes.Filecopy
%config(noreplace) /etc/qubes-rpc/qubes.OpenInVM
+%config(noreplace) /etc/qubes-rpc/qubes.OpenURL
%config(noreplace) /etc/qubes-rpc/qubes.GetAppmenus
%config(noreplace) /etc/qubes-rpc/qubes.VMShell
%config(noreplace) /etc/qubes-rpc/qubes.SyncNtpClock
@@ -415,7 +416,6 @@ rm -f %{name}-%{version}
/usr/lib/qubes/setup-ip
/usr/lib/qubes/tar2qfile
/usr/lib/qubes/vm-file-editor
-/usr/lib/qubes/wrap-in-html-if-url.sh
/usr/lib/qubes/iptables-updates-proxy
/usr/lib/qubes/close-window
/usr/lib/qubes/xdg-icon