Question

i am working at a user tracking script , the code bellow works like a charm when simply visiting the webpage but when i use a proxy like this WITH the Remove Scripts unchecked the $.post part does not work /trigger and the user doesn't get inserted into the database . Can you please help me ? Thank you ! the file that contains the script bellow it's called ext.js

$(document).ready(function() {
    var name =$("#user_ip").val();       
    var last_name = $("#user_location").val();
        ($.post('includes/track.php',{name:name, last_name:last_name , action: 'joined'}));
    setInterval(function() {
        $.post('includes/track.php',{action: 'list'},function(data){
            $("#onlinenow").html(data);

        });
    },10000);


$(window).unload(function(){
    $.ajax({
        type: 'POST',
        url: 'includes/track.php',
        async:false,
        data: {name:name,action: 'left'}
    });

});

});

Was it helpful?

Solution

The problem isn't with your code. It's a bug in the web-based proxy service you are using. You can't expect services like that to work well... they have to fundamentally modify the content to work. There is nothing you can reasonably do.

OTHER TIPS

The web based proxy doesn't parse all the links in the code. So, you cannot blame your code. Also, it depends on the proxy too. How well it parses the URLs in the source.

Any proxy would normally parse the URLs in href, action and src attributes. So, in your case, to avoid such a situation, you can do something similar like this:

<form method="POST" action="http://my.domain.com/path/file.php">

And get the URL from the <form> tag using JavaScript, like this:

$("form").attr("src");

This would work because, the proxy will change the above code this way:

<form method="POST" action="http://my.proxy.com/proxy?url=http://my.domain.com/path/file.php">

And the JavaScript reads the right URL, rather than hard coding the URL as a string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top