$_SERVER['HTTP_REFERER'] ; 是获取链接或获取提交当前页的父页面URL
那请问下 例如 www.hhhhh.com/index.html 在 www.hhhhh.com 目录下的index.html 页面里面 iframe 一个页面进来http://www.tttt.com/index.php 如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body><iframe src="http://www.tttt.com/index.php" frameborder="0" scrolling="no" ></iframe>
</body>
</html>
因为$_SERVER['HTTP_REFERER'] ; 是写在 http://www.tttt.com/index.php 这个文件里面的。
这样的话 $_SERVER['HTTP_REFERER'] 获取得到的URL 是直接获取 当前页面的URL 即http://www.tttt.com/index.php 而不是 www.hhhhh.com/index.html 这个页面的URL
请问像这样做法 怎么样才能获取的是客户直接访问的URL 即获取的URL是www.hhhhh.com/index.html而不是嵌套页面的URL http://www.tttt.com/index.php
那请问下 例如 www.hhhhh.com/index.html 在 www.hhhhh.com 目录下的index.html 页面里面 iframe 一个页面进来http://www.tttt.com/index.php 如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body><iframe src="http://www.tttt.com/index.php" frameborder="0" scrolling="no" ></iframe>
</body>
</html>
因为$_SERVER['HTTP_REFERER'] ; 是写在 http://www.tttt.com/index.php 这个文件里面的。
这样的话 $_SERVER['HTTP_REFERER'] 获取得到的URL 是直接获取 当前页面的URL 即http://www.tttt.com/index.php 而不是 www.hhhhh.com/index.html 这个页面的URL
请问像这样做法 怎么样才能获取的是客户直接访问的URL 即获取的URL是www.hhhhh.com/index.html而不是嵌套页面的URL http://www.tttt.com/index.php
<script>
document.write(parent.location.href);
</script>
我在www.hhhhh.com/index.html 这个页面里面加上下面的js
<script language = javascript>
var url=window.location.href;
document.write(url);
</script>这样可以直接输出 RUL 因为 我的http://www.tttt.com/index.php 是一个表单页面,,如何让访问点击提交按钮 获取 这个index.html 的js 这个URl
1.你认真调试一下,最起码先http://www.tttt.com/index.php?url=11,先获取看一下
echo $_REQUEST['url'];能不能输入2.如果第一步没有问题,再用<script>document.write(url);</script>试一下,完整的应该是
<iframe src="http://www.tttt.com/index.php?url=<script>document.write(parent.location.href);</script>" frameborder="0" scrolling="no" ></iframe>