Is it okay to do this?

    Date: 05/14/05 (Javascript Community)    Keywords: php, browser, html, java

    I have been wondering... How do I pass on some data to a html file given that cookies are disabled on the client's computer, and the server does not support scripting - PHP, Perl, CGI, etc. ??? The problem has to be solved on the client's side.

    Let's say we have two files: p1.htm and p2.htm. The JavaScript in p1.htm wants to load p2.htm into the browser. But p1.htm needs to pass certain values to p2.htm. How do you do it?

    Here is what I found:

    p1.htm will load p2.htm and insert the data into the address field like this:

    location.href = 'p2.htm#mydata123';

    The JavaScript function in p2.htm will read the "location.href" variable and remove everything that precedes the '#' sign. What's left is "mydata123"!!!

    This way, I can pass parameters from one file to the next.

    My question is, IS THIS 'LEGAL'?

    What the script is doing here is basically tell the browser to load p2.htm and go to LABEL mydata123. Of course, there is no such label in p2.htm, so the browser will just go to the beginning of the page.

    Source: http://www.livejournal.com/community/javascript/67112.html

« 10 lines of stars || scrollbar »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home