How to avoid web crawlers and bots to call your script? - javascript

My website is having a script tag which links to a script which helps me keep track of all the user activity in my web page. My web page has click events linked to that script's function.
I want web crawlers and bots to either not load that script or send me wrong data from the click events.
Also want to know if web crawlers and bots can call the script scr or call the click events in my page and send me wrong data from that page. Is this possible??
Thank you in advance.
I checked the whole internet and found nothing, stackoverflow community can help!! Please.

Related

Load a website in the background and once done redirect to the loaded website

I'm searching for a method to say:
<a href="http://example.com>click me</a>
<script>
If the <a> was clicked, don't redirect immediately, but instead, load http://example.com in the background, and once that is done, redirect the user to http://example.com
</script>
So this way, the user will wait inside my website, instead of waiting in the other website.
respectful right?
I know that the people will ask why do you want to do that. Please I'm just testing something..
What I think is: that it's maybe impossible using Javascript only, but I think that we can do it using some backend, I don't mind if you reply with nodejs or php, I like the more advanced boys.
So this way, the user will wait inside my website, instead of waiting in the other website.
respectful right?
Doesn't sound like it to me. People would likely rather see that next page loading. You might be surprised to know that a lot of people don't have great internet connections, and can read the text of a site well before the rest of it loads. Even if you could pull this off, you'd be breaking that behavior for them.
Fortunately, what you're asking to do isn't possible. If you were in control of the site, you could use the Fetch API or AJAX to load content in the same page context, but that doesn't sound like it applies here.
You cannot load example.com in background as browser which loads the example.com is on user side.
You could use a hidden div and load example.com into it and show that div once loading is completed but that would mean the user has not left your website at all.
As soon as hyperlink is clicked the browser starts their handshake with that other site and you lose the control of what happens between users browser and the server of example.com

How to Prevent Authentication for Specific Sharepoint Page

I would like to set our user's Microsoft Outlook Home Page to point to our intranet news page(hosted on Sharepoint).
I finally managed to suppress some JS errors I was getting when trying this (See this question).
However, when users access this homepage through outlook, they are asked to provide their Sharepoint credentials. They are then not required to do so for the next 24 hours. The next morning, they will be asked to provide credentials again.
Is anyone aware of a way around this, perhaps by embedding a script into the page or by setting some specific page permissions? Usually, the user can access the site without having to log in if they navigate via IE, so why does this not carry over to the Outlook web browser?
Any help or guidance is much appreciated.
Many thanks
Have you push down the GPO Settings for IE Settings - Trusted Intranet Zone?
Another way is to turn on Anonymous Access to your portal. See link
to solve this problem I changed my approach completely.
Instead of linking to the web page directly in Outlook I created scheduled task which queries the SharePoint server for the news article data, and then builds an HTML page with the 10 latest articles.
This task runs hourly and the HTML file is linked to on each user's Outlook homepage.
If anyone would like to see the code I use to achieve this please efelf ree to message me.

How to know when Google Analytics has saved data

I have a page I'm working on that is just a redirect page to get some browser data before sending them off to an external site. It's a white HTML page with just the google analytics code and then it redirects to Kickstarter. My problem is I don't know when I can redirect them. I want to know when the data was sent to their servers so I can redirect them. I can see how to get callback data for custom tracking, but I want all the browser data.
I see this code here: https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced#hitCallback
But that seems to just be custom page view sends. Is there anyway to just do a general onload event for google analytics?
UPDATE: Some people are finding my question hard to understand. I'll try to make this simpler although I figured this was almost as simple as I could make it.
I'm doing nothing custom with Google Analytics. I just want to know when, on any page that has google analytics tracking code (the stuff you copy and paste) has loaded and sent the data up to Google. So, in theory, like ga.onload(function () { ... }). Hope that helps?
Oscar,
What's difficult to picture in your question is the navigation flow and where to pinpoint the issue:
A page redirects to a page to get some browser data before sending them off to an external site.
Google recommends placing the tracking code on the redirecting page as well as on the landing page. This way, the redirecting page will capture the actual referrer information for your reports.
Fundamentally, whenever the user hits a page with the tracking script a request to google is sent notifying about the visit. However, some browsers may actually redirect before the JavaScript call from the code can be made.
Possible solutions:
Implement your own counter inside the redirect script, separated from GA
Implement an event before the redirect happens
Implement an event on the redirect page with the useBeacon parameter
References:
https://support.google.com/analytics/answer/1009614?hl=en
track a redirect page with google analytics

How do you track how many sites have an actively embedded iframe widget?

I have an iframe widget that is being embedded in over 3000 third party sites, but I want to know exactly how many sites it is embedded in.
Our current method is to use google analytics to generate a list of referers, and have a script manually curl each url in the list to look for our widget.
Another method we were thinking of is to use php to print a $_SERVER['HTTP_REFERER'], and use javascript to fire an analytics event if it determines the page is in an iframe, but as the referer can be manipulated, I don't know how effective it would be.
Thanks!

How can I prevent saving/downloading web page?

I was wondering if there was a way to prevent a user from saving/downloading a web page? Specifically, I mean not letting them have access to the data displayed through my web application on their own machine?
I've heard that this is not possible since the browser must have access to the source code/data, but at the same time, I've noticed that if I to my gmail account, open an email, save the page, but when I try to open that page on my computer, it doesn't work. Furthermore, if I click "view source", I can see that even the source does not display the entire email message, even though the email is opened in my browser.
How it's possible for gmail to prevent me from seeing that email data?
Thats what called rendering pages using dynamic data without refreshing page (AJAX). The entire page source code is not downloaded in one go and components within the page request data asynchronously to display content. Try googling it and you will find more information.
In View source you can only see the HTML, CSS, JavaScript codes. No one can copy any dynamic code (PHP) from view source.
You can't stop anyone to see your html,css code in browser, as we are having view source option.
Maximum what you can do is disable right click on your page. Thant can be done through JavaScript.

Categories

Resources