Index: chrome/browser/resources/shared/js/util.js |
diff --git a/chrome/browser/resources/shared/js/util.js b/chrome/browser/resources/shared/js/util.js |
index 1efbf1907f9ded5739a8ae3976f1971461de5337..7b7ffd4803652f8d1c8063524ac8b4bf8539cc4e 100644 |
--- a/chrome/browser/resources/shared/js/util.js |
+++ b/chrome/browser/resources/shared/js/util.js |
@@ -149,3 +149,19 @@ document.addEventListener('click', function(e) { |
} |
} |
}); |
+ |
+/** |
+ * Creates a new URL which is the old URL with a GET param of key=value. |
+ * @param {string} url The base URL. There is not sanity checking on the URL so |
+ * it must be passed in a proper format. |
+ * @param {string} key The key of the param. |
+ * @param {string} value The value of the param. |
+ * @return {string} |
+ */ |
+function appendParam(url, key, value) { |
+ var param = encodeURIComponent(key) + '=' + encodeURIComponent(value); |
+ |
+ if (url.indexOf('?') == -1) |
+ return url + '?' + param; |
+ return url + '&' + param; |
+} |