How do I pass a query string to a HTML frame?
I have the following HTML in index.html:
<HTML>
<FRAMESET rows="200, 200" border=0>
<FRAMESET>
<FRAME name=top scrolling=no src="top.html">
<FRAME name=main scrolling=yes src="/cgi-bin/main.py">
</FRAMESET>
</FRAMESET>
</HTML>
The frame src is main.py which is a python cgi script. This is in main.py:
import cgi
form = cgi.FieldStorage()
test = form.getvalue('test')
Suppose I call the url using index.html?test=abcde. How do I pass the query string to main.py? Is this possible using javascript?
This should help you get variables from the query string, which you can use to build your custom queryString. Or if you want to pass the query string as it is to the frame, then you could get it a simpler fashion.
var queryString = window.location.href.split('index.html?')[1];Now, as for passing it to the frame, it should be easy because you’d just be appending the query string to the frame element’s
srcattribute.