Getting the passed parameters

(This page is part of a demo of passing parameters between pages)

(1) Restored from the parm_value cookie:

(2) Restored from the top.parm_value variable:

(3) Restored from the top.name property:

(4) Restored from the query string:

Discussion

Each of the above methods may or may not work, depending on the user's browser version/settings and your site configuration. Here's why the above methods might not work:

(1) The cookie method won't work if the user disabled cookies.
(2) The method using a variable of another window/frame won't work if there are no other windows/frames. This is the case, for example, when your site is viewed in one non-framed browser window or when your script is unaware of other exisiting windows of the browser.
(3) The top.name method won't work in old browsers (such as Internet Explorer 3.x or Navigator 2.x) because in these browsers the top.name property is read-only and your script cannot change its value.
(4) Finally, the method using a query string will not always work for pages on the local hard disk. For example, it won't work in Internet Explorer 3.x and 4.x because these browsers do not support query strings for files on the local hard disk.

Note also that methods (1) and (2) won't work if you try to pass a parameter to a destination page on a different website. (For security reasons, unsigned scripts can share cookies and variables only if the scripts reside on the same website – same-origin policy.)

Copyright © 1999-2011, JavaScripter.net.