Let my site be http://cars.com
I have links on my site, to http://girls.com
, http://google.com
, http://happy.com
, etc.
Here is js:
$("#wrapper a").live('click', function()
{
var this_url = $(this).attr("href");
$.ajax({
url: this_url,
complete: function(){
//do something
}
});
});
So, when we click on a link, it loads html of that page.
How to:
$_SERVER['SERVER_NAME']
on php. href
? such symbols like " #, ?
" should be removed href
is an url (can be /section/images/
or just /
) to my site ( $_SERVER['SERVER_NAME']
)? If not, do nothing (don't want to load html of other sites). Thanks.
location.host
property . Use a regex to parse the string.
For example:
var pathSection = /^[^?#]+/.exec(url)[0]
/^\\w+:/
. this is not possible for security reasons the restriction is called Same Origin Policy or short SOP. You can bypass this by proxying the request via a server side script.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.