Jump to content

Assign Source Code Of Clicked Link To Variable


Archdeacon

Recommended Posts

I am very new to javascript (but have had years writing VBScript) and wouldlike to know how to accomplish the following (I cant use ActiveX as this willnot work in Firefox):1. When the user clicks on a link to a web page, assign the source code of that page to a variable before extracting certain values using a Regex (that is not a problem).2. Assign those values to an environment variable so that they are retained if the page is closed but picked up when the page is refreshed.3. Delete the environment variable only when the browser is closed.

Link to comment
Share on other sites

For internal links, you can use AJAX to get the target's content (1). Then you can use cookies to store the values (2) (however cookies have a size limit, you may be better off just storing the URL and retrieving the content every time). However you can't operate session cookies in JavaScript (3) so you may just have t oset a short timeout for the cookies.To fetch the source of external pages or to use sessions you need the help of a server-side language.

Link to comment
Share on other sites

For internal links, you can use AJAX to get the target's content (1). Then you can use cookies to store the values (2) (however cookies have a size limit, you may be better off just storing the URL and retrieving the content every time). However you can't operate session cookies in JavaScript (3) so you may just have t oset a short timeout for the cookies.To fetch the source of external pages or to use sessions you need the help of a server-side language.
Link to comment
Share on other sites

For internal links, you can use AJAX to get the target's content (1). Then you can use cookies to store the values (2) (however cookies have a size limit, you may be better off just storing the URL and retrieving the content every time). However you can't operate session cookies in JavaScript (3) so you may just have t oset a short timeout for the cookies.To fetch the source of external pages or to use sessions you need the help of a server-side language.
Yes, exactly; but as I said, I am very new to javascript. Any chance of an example please?
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...