rascle Posted June 11, 2009 Share Posted June 11, 2009 Hi I want to be able to click on some text and the source code pops up (i need to know how to do it for a bigger application, and yes i know u can view the source code by right-clicking view source or Edit> View source, but i want to be able to do it with javascript). At the moment i have found this code: <html><head><script language=JavaScript><!-- function ViewSource() { location.href = 'view-source:http://www.rasclerhys.com'; }// --></script> </head><body bgcolor="#666666"> <a href=javascript:ViewSource()>View Source</a></body></html> However when i click on the link it takes me to a page with the url "view-source:http://www.rasclerhys.com" and has an internet explorer error. Is this because the code is incorrect or does it not work in my browser for some reason, I am using Internet Explorer 8, maybe there is something i need to enable for this too work??? Thanks Rhys Quote Link to comment Share on other sites More sharing options...
rascle Posted June 12, 2009 Author Share Posted June 12, 2009 I have found a website (http://www.dan.co.uk/viewsource/) And want something like above ^^^ But dont know how they did it. Does any1 else know if so please let me know Thanks Quote Link to comment Share on other sites More sharing options...
jxrd Posted June 12, 2009 Share Posted June 12, 2009 IE doesn't support it cause it sucks. Why you use it is beyond me. They probably use curl of sockets. Quote Link to comment Share on other sites More sharing options...
Axeia Posted June 12, 2009 Share Posted June 12, 2009 http://getfirebug.com/lite.html firebug lite? The site you linked to does something rather different from what you posted and would indeed require curl to read the response headers. Quote Link to comment Share on other sites More sharing options...
rascle Posted June 13, 2009 Author Share Posted June 13, 2009 Ok Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.