TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-10-2009, 07:07 PM   #1 (permalink)
The Wanderer
 
superthin's Avatar
 
Join Date: Aug 2008
Posts: 16
Thanks: 7
superthin is on a distinguished road
Default I cannot get domain / url from an html page

Hello!

I have many .html files. They contain unchanged information as: quarterly reports, annual reports, term of services,... I don't use PHP because of server load problem.

Most of them ( .html files) is inserted into http://mydomain.com/index.php as iframe.

Recently, I found other websites "borrowing" my files into their iframe. I tried to make a barrier (using some JavaScript lines in .html files) and I failed.

An example my .html file: myreport.html

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>My report</title>
<script type="text/javascript">
//var myID = location.hostname;
var myID = parent.window.location.href
var mydomain =/mydomain/gi;
var mymatch = myhref.match(mydomain);
if (mymatch==null || mymatch=='') {
	alert('Please go to http://mydomain.com');
}
// or
if (location.href!=top.location.href) {
alert('Please go to http://mydomain.com');
} 
</script>
<body>
.... (my report here)...
</body>
</html>
Everything was not OK as I expected. Alert didn't work when my .html files was inserted into orther sites. I tested with mytestdomain.com and Firefox's Error Console (Ctr + Shift + J) said "Error: Permission denied to get property Location.href Source File: http://mydomain.com/myreport.html Line: 10".

I think the browser prevent XSS access. So, JavaScript cannot get parent window URL from other domain. I could not explore which domain / site inserted my files with JavaScript.

My .htaccess file is too big. I don't want to you it.

Please help me using JavaScript to prevent others to get my .html files. I want to use JavaScript in these files.

Any suggestions or help will be appreciated. Thanks a lot.
__________________
http://khoancatbetong.com - Vietnamese Concrete Technician Forum
superthin is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
help on making my own crawler webtuto General 16 08-08-2009 08:55 AM
How to create a gallery class Tanax Advanced PHP Programming 22 06-23-2009 11:36 PM
Send function result to html page ? Peuplarchie General 1 05-04-2009 05:58 PM
Execute a script and call that file in an HTML page j4v1 General 2 05-22-2008 01:41 PM
Starting with php in my html page Shinoken Absolute Beginners 5 01-08-2008 01:34 PM


All times are GMT. The time now is 11:38 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design