[Javascript] Share Code with other Web site

Paul Novitski paul at juniperwebcraft.com
Sat Sep 23 16:09:39 CDT 2006


At 9/23/2006 11:51 AM, coldfusion.developer at att.net wrote:
>I'm a newbie to Javasript and was looking for an example of how to use
>JavaScript to share your HTML with other Web sites.  So I would want
>to give them a link to a javascript on my web site that they would copy
>and paste on their web site. I don't want these users to be able to edit
>the ode that this scrit displays on this web site.  Much like the the way
>that google's ad sense works.
...
>The other question is, I will be dynamically generating and passing 
>parameters
>into this javacode that will be just for this user.


 From your description, it sounds to me as though JavaScript by 
itself might not be the right choice, but instead a combination of 
JavaScript and a server-side scripting language such as PHP.

You can't give JavaScript to someone but prevent them from editing 
it.  You can go to a great deal of effort to obfuscate the script, 
but unobfuscating it is child's play and your time will be better 
spent on other aspects of your work.  A server-side script, in 
contrast, can provide results to the user while remaining completely 
inaccessible to them as script.

Using PHP, you can give someone a simple url such as 
http://example.com/clientcontent/?id=1123456890 which will resolve to 
anything you want -- an image, text, or HTML markup.  An iframe or 
XMLHttpRequest on the client's website can then incorporate that 
content into their page.  You might try googling XMLHttpRequest and 
Ajax to see JavaScript's role in such a collaboration.

Regards,
Paul 




More information about the Javascript mailing list