Lets imagine that we have a web page. We don't have direct access to this page so we couldn't change the source code but we need to add a js to it contents. Is there any way? I mean for example external javascript or any other way.
- This is for what purpose?. You can use Firebug or such browser plugins to do so , for your own purpose.NT_– NT_2012-05-03 11:47:37 +00:00Commented May 3, 2012 at 11:47
- 3greasemonkey is what you need.Elzo Valugi– Elzo Valugi2012-05-03 11:47:51 +00:00Commented May 3, 2012 at 11:47
- Big_buka , Yes @Elzo is right, Greasemonkey is the best.NT_– NT_2012-05-03 11:49:20 +00:00Commented May 3, 2012 at 11:49
- lol! hacking questions at stackoverflow xDSebastian Breit– Sebastian Breit2012-05-03 11:49:45 +00:00Commented May 3, 2012 at 11:49
- Who is "we"? Are you responsible for loading a page within an iframe of a page you own? If so, browser-level security will prevent you from accessing the page in the iframe if it is on a different domain. This is to prevent cross-site scripting attacks. If you are in control of the browser that is loading the page, you can use something like Greasemonkey.Ivan Karajas– Ivan Karajas2012-05-03 11:52:09 +00:00Commented May 3, 2012 at 11:52
Add a comment |
3 Answers
Without any access, you of course can't add any script to the site. What are we talking about? XSS instructions ?
You maybe should clarify what exactly you're after and for what reason. The above statement remains true, no access, no permanently adding any script (without some kind of xss attack).
If you just want to inject code to a page you locally openend, you can just use any js-console like Firebug. For instance
var head = document.head || document.getElementsByTagName('head')[0] || document.documentElement, scr = document.createElement('script'); scr.src = 'http://myserver/myscript.js'; scr.type = 'text/javascript'; head.insertBefore(scr, head.firstChild);