Get Current Page URL From Bookmark on toolbar using PHP - php

I am looking to get the url of current page in url bar
[BookMark Button In Tool Bar] - User Presses it while on a youtube link
and sends it to sitename.com/test.php
The url in the bookmark then prints something like
sitename.com/test.php?url=http://www.youtbe.com/whateverwatever
I tried using referrer bur since it's coming from a bookmark link it won't work
I also tried the referrer in Javascript but it still won't work

I believe you just want window.location.href. That'll get the current location then you can do what you want with it.

You can't do this, as there isn't a referrer if you click a bookmark.
If you're trying to make a "share this" bookmark sort of thing, you can use some JavaScript to make a "bookmarklet". Delicious has a bookmarklet that does this sort of thing.

Related

Efficent url redirection in php

I am using a url redirection technique similar to google
Example
if you type wikipedia in google you get a wikpedia page result but if you click the link it will first go to this kind of redirecting link
http://www.google.com/url?some_paramaeters_for_wikipedia_page_redirection
and then it will go to
http://www.wikipedia.org/
i have made similar algorithm in my website and its working properly;But as in google when you want to copy the link location
it doesnt copy the main web link
http://www.wikipedia.org/
Instead it copies
http://www.google.com/url?some_paramaeters_for_wikipedia_page_redirection
I want to know if it is possible for users to copy the orginal link instead of url redirecting link without changing redirecting method.
Thanks for your info
Yes, what you should do is keep the real link in the href attribute (so the "Copy link location" works),
and with a bit of Javascript, on the click event of your link, replace this real URL with your redirecting one's.

How do I find out that a link was seen

I'm trying to make a page with some links and when somebody clicks on a link, the score count will go up.
How can I find out the visitor who has really seen the page related to link? But not just click the link and close the page for score...
really seen means: page loads completed.
and my links opens in new window.
any solution?
You cant really see pages that aren't in the same domain. Chrome even puts them in a separate thread.
Back in the day you could have used a CSS exploit talked about here: https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector
If you really want to make a page with this kind of functionality you will have to make a browser plugin/extension.
You can include a nonce token in the link, and post that token to the server, render the page embedding that same token in some javascript and have the javascript post back the token when the page is done rendering. Seems kinda overkill though.
The only thing I could thing of is maybe make the link to like a redirect page on your site and then you could control to see if the page was loaded and then like after the page was loaded redirect to the actual webpage to link is intended. This way you know for sure that the user waited to view the webpage.
Other than that I don't think there is any other way for you to go about this.

How to implement browser history and bookmarks with jquery mobile and ajax

I am trying to build a site with JQM, JQuery, PHP and MYSQL. The idea is to use ajax to pull information from the database (JSON) to insert it on the page. My only issue is that I am not sure how to implement the ajax in a way that makes it easy to bookmark pages and go back (to the last page) on the JQM site. I was thinking to use pushstate but am not sure on how to implement it. Can anyone point me to a tutorial on how to do this effectively or if they can put up some example code.
Save it in the page url, so lets so your page URL is: test_page.php and json URL is test_json.php. You want to bookmark the page for all with the name "mark". So you bookmark test_page.php?name=mark. Then on page load you define it to your json to get all for mark.
This way you can bookmark the URL and just fetch according to the parameters in the URL.

Activate external href onclick from link

Let's say you have a link on your site and when you click that link it brings you to a different site. A site that you do not own and I would like it to have a "onclick" already activated maybe from a script that redirects to that link. Is this possible?
Simple answer NO. If possible it would be called 'mousejacking' :)
Setting window.location.href to a target link URL in javascript will, for most browsers, redirect the browser to the specified URL.
If you're specifically trying to make a link on your site redirect the user to a Google Search, read here.
There is almost no good reason to wrap an external site that you do not own in a frame. That kind of stuff is usually considered shady/malicious.

I'm not sure if I should use a redirect

I have an affiliate link on my webpage. When you click on the link it follows the href value which is as follows:
www.site_name.com/?refer=my_affiliate_id
This would be fine, except that the site offers no tracking for the ads, so I can't tell how many clicks I am getting. I could easily implement my own tracking by changing the original link href value to a php script which increments some click stats in a database and then redirects the user to the original page. Like so:
<?php // Do database updating stuff here
Header("Location: http://www.site_name.com/?refer=my_affiliate_id");
?>
But I have read some articles that say that using redirects may be seen by google as a sign of 'blackhat' techniques and they might rank me lower, unindex my site or even hurt the site that I'm redirecting too.
Does anybody know if this is true, or have any idea of the best way I could go about this?
Many thanks in advance
Joe
You could always do what Google does with search results. They have the link href normal, until the mousedown event. something to the effect of:
adlink.onmousedown = function(e) {
var callingLink = /* stuff to actually get the element here */;
callingLink.href = 'http://mysite.com/adtrack_redirect_page.ext?link=' + escape(callingLink.href);
}
Or something like that :P
So, Google will see a normal link, but almost all users will be redirected to your counter page.
Using a 301 redirect simple tells Google that the website is permamently moved. It should have, according to most random people on the internet and according to Google itself, no effect on your page-rank.
Actually I've read (can't remember where exactly) that this kind of redirect DOES HURT your rating. No, it won't "kill" your website nor the referenced, as far as I know (and please do check further), but it will hurt your site's rating as I said.
Anyway I'd recommend using some javascript to refer anything out of you domain - something like "window.open(....)" should do the trick, as Google will not follow this code.
There, refer to your tracking script which will redirect further.
You could use a javascript onClick event to send an ajax signal to your server whenever the link is clicked. That way the outgoing link is still fully functional, and your server-side script can increment your counter to track the clickthrough.

Categories