LinkedIn Follow button plugin is opening a blank window - linkedin

Using LinkedIn's site that creates the scripts for plugins, I created the plugin with the following script:
<script src="https://platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/FollowCompany" data-id="2922419" data-counter="top"></script>
I tried different things; with the https, without it (as they posted), but whenever I click on the button, it just opens up a blank window. What am I doing wrong?

it is not a big issue if LinkedIn Script is not working fine then just add your own onclick redirect url.i-e onclick="window.open('https://www.linkedin.com/company/{companyID}/');" and then add style="pointer-events:none;" css to its child(i.e LinkedIN scripts) to make its default behavior overridden.

Have you tried including the URL with your button? E.g:
<script type="IN/FollowCompany" data-id="2922419" data-counter="top" data-url="www.yourdomain.com/path/to/your/page"></script>
Replace the link with the page you want to share.

Related

Google tag manager adding async scripts in to head of page

I've recently moved some of our scripts into Google tag manager via Custom HTML with a document with write enabled. However, most, if not all scripts are being added to the head of the page as a async script.
For example:
<head>
<script async type="text/javascript" src="https://www.externalSite.co.uk/visitor.js?mhRand=1513770036670"></script>
</head>
Why are these being added to the head of the site, instead they should be loaded at the bottom of the page?
Am I missing a setting somewhere within GTM?
All Tag Manager Tags are loaded Async so no need to specify it.
You can not use the labels on the HTML Tag.
Since you can not control that i ll be load on the header you might want to do it as soon as possible. In order to do this just use a pageview trigger and firing priority. If any resourses depended on this script here is a nice post.

Phpstorm Live Edit not working with external css and js files

Phpstorm Live Edit not working with external css and js files.
But when i change html/css/js code in .html (.php) files it is work nice.
Problem only with external files, like:
<link rel="stylesheet" type="text/css" href="css.css"/>
<script src="js.js"></script>
Please make sure that 'Update' in Settings/Build,Execution,Deployment/Debugger/Live Edit is set to 'Auto in (ms)' and 'Restart if hotswap fails' is enabled. Changes in HTML code are updated in the browser automatically regardless of the selected Update mode; but this is not the case for js and css - in Manual mode, you need to click the Update Application button on the debugger tool window or in the main Run menu, or press cmd+F10 to get page refreshed.
See http://blog.jetbrains.com/webstorm/2014/08/live-edit-updates-in-webstorm-9/

Redirect Page to Mobile Version in Wordpress

I would like to setup mobile redirection using the htaccess in my Wordpress website.
I have a mobile site (mobile.domain.com) and regular site (domain.com) The permalinks will be the same for each site e.g. domain.com/page-one/ and mobile.domain.com/page-one/ so it seems like it should be fairly easy to redirect to the same page in the mobile site.
I've tried looking online and cant find what I need, can anyone help with this? I would be happy just using a plugin if one already exists.
I know this is an old post, but after figuring this out I think the solution I used is worth mentioning here.
Everyone knows that a simple Javascript redirect will work great, but what if you want the user to end up on a page that has the exact same path name? If you have this redirect, then "example.com/contact" will be redirected to "mobile.example.com" - notice how this is not the mobile version of the contact page.
The solution is to have a Javascript snippet in the main header that will tell each page to keep its same pathname when redirected, such as "/contact". The one caveat is that each mobile page must be named the same as the desktop version - /whatever and /whatever.
<script type="text/javascript">
<!--
if (screen.width <= 800) {
document.location = "https://mobile.example.com" + window.location.pathname;
}
</script>
you could do the following in javascript:
<script language="JavaScript" type="text/javascript">
if ((screen.width>=1024) && (screen.height>=768))
{
window.location.replace('example.html');
}
</script>
This would need to go in your header.php
Check this website http://detectmobilebrowsers.com/ for php or javascript code. You can use PHP or Javascript, that you have to paste within header.php
Solution:
Download and install plugin : CSS & Javascript Toolbox
(make sure to always backup before downloading and installing
plugins)
Add this javascript to the page you want to redirect from.
<script type="text/javascript">
<!--
if (screen.width <= 600)
{
window.location="http://www.yourmobilesite.com";
}
//-->
</script>

Why is WordPress placing "text/rocketscript" instead of "text/javascript" when using wp_register_script()?

I inserted the following code in a WordPress plugin:
wp_deregister_script('jquery');
wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
wp_enqueue_script('jquery');
The following is echoed to the browser:
<script type='text/rocketscript' data-rocketsrc='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js?ver=3.3.1'></script>
Instead of:
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
I don't know what is happening. Perhaps wp_register_script() is supposed to work in this way. I also tested if any jQuery code worked on the client side but it didn't.
It is easy to fix.
You must change the following tag: <script type="text/javascript"></script>
add: data-cfasync="false"
example:
<script data-cfasync="false" type="text/javascript"></script>
Probably one of wordpress plugins is using CloudFlare.
https://support.cloudflare.com/hc/en-us/articles/200168056-What-does-Rocket-Loader-do-
Try disabling all the plugins and re-enabling them one by one to find out which one is causing this issue. It's not a problem actually.
Rocket Loader is not included in any WordPress plugins. You would have to disable Rocket Loader by going to: settings->CloudFlare settings (Performance Settings)->Rocket Loader->Toggle Off (this feature is optional and has to be turned on).
I was facing this issue with
WP Rocket plugin which was adding type='text/rocketscript' to the script tags.
Fixed it by adding
data-cfasync="false"
to the script tags.

Embedding PDF from server in Browser

I have an ASP.NET web application.I have some PDF files in my server .I want to show those to the user via browser in a new window.how to embed PDF in a browser ? i want the save option to be available for the user to save the PDF .How to go ahead
take a look at
http://pdfobject.com/
<html>
<head>
<script type="text/javascript" src="/scripts/pdfobject.js"></script>
<script type="text/javascript">
window.onload = function (){
var success = new PDFObject({ url: "/pdf/sample.pdf" }).embed("pdf");
};
</script>
</head>
<body>
<div id="pdf">It appears you don't have Adobe Reader
or PDF support in this web browser.
Click here to download the PDF</div>
</body>
</html>
PDF files opened in the browser can be susceptible to XSS, so it is usually best to configure the server so that, when a user requests a PDF, it is opened in it's native application e.g. Adobe Reader.
To configure IIS, open up IIS Manager and:
Right-click the folder on your site where the PDF files are kept and select 'Properties'
Go the the HTTP Headers tab
Click the 'File Types' button under the MIME Map section
Click 'New Type'
Add '.pdf' as the extension and 'appliction/octet-stream' as the Content Type
Click Ok and apply the changes
Now when the user clicks a link to a PDF they should be promted with the 'Open or Save' dialog box that you are after.
I've faced the same problem and a guy from Adobe has an (old) blog post about it link text
It works fine with IE, FF, Chrome with the default Adobe Reader plugin.
Now my only issue left is to display a nice loading thingy while the plugin retrieves the PDF file that is generated on-the-fly.

Resources