If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

How can I grab the contents from a PHP file that is opened in my browser?

One my main webpage(MyPage.htm), I have different JavaScript functions, to grab different parts of another page(OtherPage.htm), that I have within an iFrame on my main page.

I grab the URL with...

Code:

document.all.myFrame.contentWindow.location

and I can grab the text within a textbox with...

Code:

document.all.myFrame.contentWindow.myform.message.value

I have a PHP file(File.php) and I would like to grab the contents on that but I don't know how to. It's a very short file, only about 15 to 20 characters long. The is no HTML tags, it just says "MrAtoBandMe12345678910".

How can I grab the info from it by using the same types of code from above? My goal is to do it in a JavaScript function, just like the other functions. I'm not wanting to open the file and copy the text, just copy the HTML/info from the iFrame.

Now, I would like to do the same thing, but I would like to do it with the Google Chrome browser, and with the "--disable-web-security" applied.

The problem I am having, it that the page shows up with an encoding error(it appears to be Chinese and it also has the squares in it). Any idea how to fix this?

When I go to 'view source', the HTML looks completely normal. This same page works in Chrome with web security disable, but not in an iFrame. The same page works in and out of an iFrame with the Internet Explorer browser. It also works fine within an iFrame in Chrome, but only in the 'safe' browser. So, it is specifically, in Google Chrome, in an iFrame, and with "--disable-web-security", that causes it.

But I hope you understand that when you use --disable-web-security *ONLY* you, looking at YOUR screen, can see the results. Your page WILL NOT WORK for anyone else unless they also run Chrome with security disabled. Maybe 1 person in a million will do that.

If you want others to be able to see cross-site content, you almost surely need to create a PHP proxy server, so that the content *appears* to all be coming from your own site.

An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

But I hope you understand that when you use --disable-web-security *ONLY* you, looking at YOUR screen, can see the results. Your page WILL NOT WORK for anyone else unless they also run Chrome with security disabled. Maybe 1 person in a million will do that.

If you want others to be able to see cross-site content, you almost surely need to create a PHP proxy server, so that the content *appears* to all be coming from your own site.

I know. I'm just doing it for the learning.

It was working fine, and now I get this encoding problem, but only on some pages. Could it be something like Flash or Active X?