modifying contents of all pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
soujisama
Forum Newbie
Posts: 2
Joined: Wed Aug 24, 2011 4:01 pm

modifying contents of all pages

Post by soujisama »

I'm running a program that loads external web pages. It however has an unfixable bug where some links aren't followed correctly. I have a JavaScript file that can convert the links appropriately after the external page has been included in the same page. Problem is after these links have been followed, I can't run the script again. How can I append the script to all pages? I can't use frames btw. I have tried to make the links load in Ajax and replace the contents of a div, but that doesn't cover buttons and onclicks. Any suggestions?
danwguy
Forum Contributor
Posts: 256
Joined: Wed Nov 17, 2010 1:09 pm
Location: San Diego, CA

Re: modifying contents of all pages

Post by danwguy »

perhaps post up some code so we can take a gander and see if we can help
soujisama
Forum Newbie
Posts: 2
Joined: Wed Aug 24, 2011 4:01 pm

Re: modifying contents of all pages

Post by soujisama »

i wonder if this will help.

this is a sample of a page that doesnt work correctly

Code: Select all

<body>
<a href=javascript:__doPostBack("foo","bar")>click me</a>
<body>
i include it in a php file as below

Code: Select all

<script src=fix.js></script>
echo "<base href=path>"
include(path/file.htm);
the javascript modifies the link to

Code: Select all

<a href=javascript:__doPostBack("foo","bar") onclick=doPostBack("foo","bar")>click me</a>
this works in the application.
the only problem now is when a link is followed, needless to say, my include patch dissapears as it is a direct link to a file on the other server.
i can patch the anchors to link to this same proxy page so as to load the include patch again, but that will not cover for buttons and other onclick methods.

better?

thanks.
Post Reply