Pinterest board widget links not working - asp.net-mvc

I am trying to use the profile widget from pinterest found here. In my site it loads perfectly, but if I click on the images the links do not work.
I tried doing the same on a new ASP MVC project and it was working perfectly.
This is the code I'm using:
<a data-pin-do="embedUser" href="http://www.pinterest.com/mysite/" data-pin-scale-height="295" data-pin-board-width="310">Visit MySite profile on Pinterest.</a>
<!--pintrest-->
<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>

As Matthew pointed out, it's probaby the prefixes.
But you need to fix one more — in the script itself. Just follow the url, copy and paste the destination code (instead of calling the provided one). Add an http prefix to the assets URL. That's it. Worked for me.
<script>!function(a,b,c){var d,e,f;f="PIN_"+~~((new Date).getTime()/864e5),a[f]||(a[f]=!0,a.setTimeout(function(){d=b.getElementsByTagName("SCRIPT")[0],e=b.createElement("SCRIPT"),e.type="text/javascript",e.async=!0,e.src=c,d.parentNode.insertBefore(e,d)},10))}(window,document,"http://assets.pinterest.com/js/pinit_main.js");</script>

If you are running your file locally from a hard drive, the paths might not render correctly since the src attribute or your script tag is prefixed with //. This means it will use the file prefix instead of http when trying to retrieve additional items if those links also are prefixed with '//'. Change it to the following to see if it works:
<script type="text/javascript" async src="http://assets.pinterest.com/js/pinit.js"></script>

Related

Is it possible to use the openlayers where we dont have internet connectivity?

Since most of the example available in Internet is working based on Internet.
I would like to download and use. I don't want to use either CDN or openlayer.org in my code.
Is it possible to use openlayers without a CDN?
Yes. Like any library, you can download locally. This page has some download links to get the CSS and JS files: https://openlayers.org/download/
You download and unzip those into a folder that is accessible from your web server. Usually this is a scripts subfolder
Then you simply reference them as explained here:
https://www.w3schools.com/css/css_howto.asp
https://www.w3schools.com/tags/att_script_src.asp
(note these are very basic W3C references. You should really know this)
So if you downloaded those .js and .css files into a scripts subdirectory you do this:
<script src="scripts/theopenlayersscriptfile.js"></script>
<link rel="stylesheet" type="text/css" href="scripts/theopenlayerscssfile.css">
Edit:
After some experimenting and investigation, you mention that it is trying to access https://c.tile.openstreetmap.org/4/6/6.png
I googled and found this link
https://wiki.openstreetmap.org/wiki/OpenLayers_Local_Tiles_Example
Which says
With this example you can browse your tiles stored localy without any webserver. I use this to check my tiles I downloaded to use in Osmtracker. But you can also browse Tiles rendered by any other techniques.
The instructions at this link appear to explain exactly what you want to do - it has references to all of the files you are trying to use.

Move the asset directory for a dart project for a Jekyll blog post

I have a simple Angular-Dart web-page that works great offline with pub-serve. I want to add that page as a blog-post on Jekyll.
The problem is that Dart wants the assets (the package folder) in the same directory as the HTML file that call it. Jekyll produces that HTML file in a separate directory so that's not possible.
Basically I have:
_post/blabla.html <----- the html file/blog entry which will be built in another directory still
assets/main.js <----- the js-transformed script
assets/packages/.... <----- all the libs
But whenever I open blabla.html the jsfied Dart doesn't try to find the packages folder in the assets folder but in the _post folder. How do I tell it to look in a different directory?
Solution 1
Try to add your page as a page at the root of your site, instead of using it a a post.
The blabla.html will then be at yourdomain.tld/blabla.html an then refer to assets/script.js as yourdomain.tld/assets/script.js.
Solution 2
Use the baseurl variable in _config.yml.
The point to your assets with <script src="{{ site.baseurl }}/assets/main.js"></script>. This will target aseets relative to the root of your site.
Found it!
Angular can be redirected by using the following html code:
<base href="{{ site.baseurl }}/assets/">
It's documented in angularjs but not angular dart which made it so hard to find!
I add that as an _include in the jekyll post and everything is peachy

My js in the Scripts folder are not being loaded in my MVC4 app

I have 2 scripts. One is in a Folder called ItemMenu in the root and the other is in the Scripts folder that is also in the root.
The script in the Scripts folder is never loaded, but the ItemMenu one it. They are both included in a script tag the same way on the client.
Here is the HTML render of the scripts.
<script src="/Scripts/article_layout1.js"></script>
<script src="/ItemMenu/itemMenu.js"></script>
If, I use the full URL it will work - but this won't work long term.
It's not making any sense to me.
I have confirmed the locations of these and "/Scripts/article_layout1.js" can be accessed by navigating directly to the URL. I have confirmed the spelling and folder names.
Does anyone have any idea here? This is going to make me crazy maybe.

Error loading external URL in Phonegap 2.5

I created a new Phonegap 2.5 project from scratch, and I've been trying to load an external URL in it, but I keep getting input boxes popping up on startup before loading the actual URL. I first get a pop-up with the URL of the website, then in the input box it says "DeviceInfo","Device652321624". If I click Cancel, it pops up 2 more times before loading the website. On the website itself, it loads some relative URLs, but others cause the entire page to refresh and the input boxes to pop up again.
I set the URL by setting <content src="http://phonegap.example.com" />, which is just a regular website with Javascript. I even tried commenting out all Phonegap specific code (no more ondeviceready calls), but it still causes the problem. http://www.google.com loads for me, so I'm not sure what else to check. And it works with the Android version that I've developed.
If it helps, I've also seen this message in the XCode log: Resetting plugins due to page load.
I've had the exact same problem today.
I fixed it by checking the include of the cordova.js file (this js is generated when you create the project using the create command.
( called cordova.js in the renamed cordova project version. probably phonegap.js in phonegap ?)
anyway my include was :
<script type="text/javascript" src="js/cordova.js"></script>
whereas je js file was in the project root :
I changed it to
<script type="text/javascript" src="cordova.js"></script>
and every things is fine now.
also, the 'create' command for Android generate a different js file. make sur that the new one generated for ios is used.
hope that helps !
Problem is you are using android's cordova.js instead of ios's cordova.js.
Just make sure you are using the proper one.

Why is my .js file going to a 404?

I'm using Wordpress, and I linked some masonry jQuery library files and when trying to visit the .js file, it goes to a 404. However, my custom functions are viewable and so is the jQuery .js file. Why might it be going to a 404? I spent 1 hour trying to figure out why my function wasn't working and it turns out the file wasn't being loaded properly.
This is how I am linking to the jQuery files:
<script language="javascript" type="text/javascript" src="http://domain.com/js/custom.js"></script>
<script language="javascript" type="text/javascript" src="http://domain.com/js/jquery.eachdelay-0.0.1.js"></script>
<script language="javascript" type="text/javascript" src="http://domain.com/js/jquery.masonry.min.js"></script>
For some reason, custom.js works fine, but not the others. I have it uploaded properly. It says "Page not found" when I try to visit the other files in the browser.
Here's the conclusion:
I created another file and deleted the old one then renamed the new one with the same name and it didn't work. So, I just ended up creating a file and naming it something other than the original default and then pasted the JS contents in to the new file I made and viola!
I think its a caching problem, I don't know how to fix it and why it happened but this was my solution. Also, people should not be so hasty to assume that the 404 means that I do not know how to upload a file and that I uploaded it to the wrong directory.
try using an absolute URL path for the js file.

Resources