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 9552fd96e7b7b845221c90da28bb3eb10a77b409..a669297d4c476ddd7ae859b2fcfef08dd1b28f91 100644 |
--- a/chrome/browser/resources/shared/js/util.js |
+++ b/chrome/browser/resources/shared/js/util.js |
@@ -187,3 +187,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; |
+} |