This cannot be done in pure HTML.
There are two ways to do this using JavaScript:
<body><script> var param = /[&?]path=([^&]+)/.exec(location.search); param = param ? param[1].replace(/"/g, '"') : ''; document.write('<object type="application/pdf" width="100%" height="100%">\n' + '<param name="src" value="' + param + '" />\n</object>'); </script></body>
An alternative method is to populate the parameter using the DOM ( demo: http://jsfiddle.net/N2GUf/2/ ):
<body><object type="application/pdf" width="100%" height="100%"> <param name="src" value="" id="param-path" /> </object> <script> var param = /[&?]path=([^&]+)/.exec(location.search); if (param) document.getElementById('param-path').value = param[1]; </script></body>
In any case, the query string is read from the location.search
property and parsed using a simple regular expression.
source share