Click to See Complete Forum and Search --> : Disable all links


entropi
10-08-2003, 04:42 PM
Is there any possible way to open a window and disable any and all links that might be on that page?

entropi
10-08-2003, 04:46 PM
... that's WITHOUT writing the disable code on the page you want the links disabled on. For example, to open a page on a site that you might not be able to write to...

AdamGundry
10-08-2003, 04:53 PM
If the page is in another domain to yours (which I presume it is), browser security restrictions prevent your page from doing anything to that page.

Adam

pyro
10-08-2003, 04:58 PM
You can only do so if the page is on your domain:

<script type="text/javascript">
function openPage() {
newwin = window.open("somepage.htm");
for (i in newwin.document.links) {
newwin.document.links[i].onclick = function() { return false; };
}
}
onload = openPage;
</script>

entropi
10-08-2003, 04:59 PM
But my boss says he insists he has seen it before, knows it is possible, etc etc... I was certain this wasnt the case because you would most likey have to write the code to the page you are applying it to, am I correct?

pyro
10-08-2003, 05:02 PM
Yes, if the page is on a different domain...

entropi
10-08-2003, 05:08 PM
No, it is on a different domain. He insists this can be done. I am trying to argue that I have NEVER seen it done, nor do I know how it could be possible... I'm right, right??? It cant be done, correct??

pyro
10-08-2003, 05:13 PM
Correct, it can not be done with JavaScript (and I doubt anything else). If he is so sure he's seen it done, have him give you a link...

Vladdy
10-08-2003, 08:45 PM
place a transparent div over the iframe another page is in. make sure to leave just enough space to the right and bottom to keep scrollbar operational....

pyro
10-08-2003, 08:54 PM
And to defend my above comment, that isn't disabling the links... :p Good solution though, Vladdy.

Vladdy
10-08-2003, 10:16 PM
Since you are not able to use the links - they are disabled :D :D :D rize above the problem :p

pyro
10-08-2003, 10:25 PM
It's all about thinking outside the box. ;) I had to do something very similar to that once, when working on a DHTML popup (during the drag function).