...

View Full Version : Kill Javascript using Javascript



mesbaba8
01-24-2004, 08:18 PM
is it possible to kill/bypass a javascript using another one?

i.e. main.html has a javascript that disables right click.

we use main.html in index.html with <iframe> tags.

can we write a such script in index.html,to enable right click again?

liorean
01-24-2004, 09:01 PM
Yes, you can overwrite the right click killing. You need to find the window that has it (using the parent keyword), and set the following properties to function (){return true;}:
- window.onclick
- window.oncontextmenu
- document.oncontextmenu
If that doesn't do it, try to kill them on each DOM element for which the onclick and oncontextmenu properties aren't null or undefined.

mesbaba8
01-25-2004, 01:55 AM
i couldnt do or i didnt understand (because of my English i think)

could you post the codes please?

Vladdy
01-25-2004, 03:52 AM
Here is a simple solution:
do not disable right click (since there is no reason for doing so) and you would not need to worry about enabling it again. :rolleyes:

Paul Jr
01-25-2004, 05:12 AM
Originally posted by Vladdy
Here is a simple solution:
do not disable right click (since there is no reason for doing so) and you would not need to worry about enabling it again. :rolleyes:
I'm with Vladdy here.

mesbaba8
01-27-2004, 09:39 PM
ok,main.html is in another server,i dont have write permission to it. So i have to disable it from index.html

Vladdy
01-27-2004, 09:41 PM
Can not script between domains PERIOD

fredmv
01-27-2004, 10:04 PM
http://www.mozilla.org/projects/security/components/same-origin.html

mesbaba8
01-28-2004, 01:48 AM
Originally posted by Vladdy
Can not script between domains PERIOD
yes youre right thank you.
but if i use

<?php

include ("http://blabla/main.html")
?>
instead of using iframe, index.html will contain the whole source ode of main.html.

glenngv
01-28-2004, 02:55 AM
I don't know php but as in other server-side languages, you can't include files from other domains. In ASP, there are built-in components as well as third-party components that can grab information from other web page but I don't know if it's also possible with php.

mesbaba8
01-28-2004, 03:12 AM
yes it works.

http://freepgs.com/mesbaba8/index.php (please take a look)

is


<?php
include("http://www.indirmax.com/default.asp");
?>

and right-click doesnt work.

i need a script to write into index.php

Vladdy
01-28-2004, 03:54 AM
Since you are using php - do it server side:
read the external file in a variable
strip all script tags
then echo this variable in your page

glenngv
01-28-2004, 04:20 AM
I was shocked php allows server-side includes like that. :eek:
You can easily make other pages your "own" page without even using a server component or something. :rolleyes:

Reading an external file in a variable requires the file system object of php or an http component not using includes. But I don't think php file system support accessing files from other domains, or from http protocol for that matter.

Vladdy
01-28-2004, 04:25 AM
http://www.php.net/manual/en/function.fopen.php
simple as that

mesbaba8
01-28-2004, 05:59 AM
it is done!

thank you all!

<?php

$dosya=fopen("http://www.indirmax.com/default.asp","r");
while (!feof($dosya))
{

$satir=fgets ($dosya,4096);
$satir=ereg_replace ("false","true",$satir);
echo $satir;
}

?>

glenngv
01-28-2004, 06:09 AM
Actually, I have the quickest solution. Use include() and put this script at the bottom of your index page.

<script type="text/javascript">
document.oncontextmenu=function(){return true}
</script>

Although using multiple include()s (as I noticed you did) would make multiple html, head, body tags in a single page.

mesbaba8
01-28-2004, 09:59 AM
yes,but it has some other scripts that prevents selecting text, etc.. so i decided to do what i did.

the original url : http://www.indirmax.com

my url : http://www.mescafe.net/****/indirmax

**** is tihs from reverse :D

but of course when you click on a link,it goes to original location again. can it be possible to make whole site right click enabled with just one file?

glenngv
01-29-2004, 01:24 AM
I can't go to your site as it is blocked by our proxy.
But if you want other events enabled, then do so.

<script type="text/javascript">
document.oncontextmenu=function(){return true}
document.ondragstart=function(){return true}
document.onscroll=function(){return true}
document.onselectstart=function(){return true}
</script>

Is that what you wanted?

mesbaba8
01-29-2004, 12:15 PM
my script simply converts all false's to true's so it doesnt need anything more.

you can use http://babelfish.altavista.com to cheat proxy.

glenngv
01-30-2004, 01:31 AM
What if (in the future) that external page contains false's other than those in the oncontextmenu, onselectstart, etc event handlers? Replacing all the false's to true's is not safe when all you need is enabling those event handlers. Some codes might be affected causing the script to behave differently.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum