Hi Is it possible to pick up parameters from the page url and add it to the forward framing SRC? So the result from the below www.new_website.com/page.html?ReferringagentID=1010&AnotherID=555 Forward framing code: <HTML> <FRAMESET ROWS="*,0" FRAMEBORDER=0 BORDER=0 FRAMESPACING=0 > <FRAME SRC="http://www.website.com" /> </FRAMESET> </HTML> I know of a similar code in cold fusion but I would like a JavaScript version of that. Similar function in Cold fusion: <cfif isDefined("url.ReferringAgentID")><cfset ReferringAgentId=url.ReferringAgentId><cfelse><cfset ReferringAgentId=""></cfif> Then at the end of the link to open a page add: ?ReferringAgentId=<cfoutput>#ReferringAgentId#</cfoutput> Any help in this would be much appreciated
ReferringagentID=1010&AnotherID=555 is referencing fields in a database correct? Can JS pull content from a database? Not sure. That is probably why they used CF or PHP. The only other way I can think of is using the document.referrer and append this to the URL. However this is a security risk if you're using sensitive data.
Try a js function like this, function displayUrlParameters() { var urlValue = window.location; var urlText = urlValue.toString(); var start = urlText.indexOf("?") + 1; var paramText = urlText.substring(start, urlText.length); var params = paramText.split("&"); var paramName = new Array(params.length); var paramValue = new Array(params.length); for(var i=0; i<params.length; i++) { start = params[i].indexOf("=") + 1; paramName[i] = params[i].substring(0, start); paramValue[i] = params[i].substring(start, params[i].length); } // Display parameter name and value for(var i=0; i<params.length; i++) { document.getElementById('MyDiv').innerHTML += paramName[i] + " = " + paramValue[i] + "<br/>" } } Code (markup): You can call this function on page load. Didnt get the time to test the code. Relpy if u find any difficulties. Hope this helps.