I'm trying to get a query string from htm file. But when I'm writing a "?param=1" in the end of the .htm url - the file not loaded and I don't see anything in this page - The error I get is: "Incorrect document syntax". When I'm opened this url without the query string in the end, its opened normally.
This is my htm file:
<html>
<head>
<title>Test Url sender</title>
<meta charset="utf-8">
</head>
<body>
<script src="file.js" type="text/javascript"></script>
<style type="text/css">
body {
font-size: 12px;
margin: 0px 10px;
}
</style>
<script type="text/javascript">
window.onload = getQueryString();
function getQueryString() {
var queryString = window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape("param").replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1");
SendUrlsToServer(queryString);
}
</script>
<p>
test paragraph
</p>
</body>
</html>
(The function SendUrlsToServer its from another js file). I need to get a query string in this url.. This htm file is web resource in crm. Any help how can I solve this? Thanks.
In CRM, a webpage (HTML) or Silverlight web resource page can only accept a single custom parameter called data. anything else will cause problem.
Read More...
You are looking for "urls" in the parameter but sending "param" instead !
Change
escape("urls")
toescape("param")
if you will be sending "param"Try below code snippet