I have to create something similar to a Facebook 'Like' button. My client would link to some custom javascript and they would put a custom dom element on their page for whatever functionality.
<head>
<script src="www.domain.com/client1.js"></script>
</head>
<body>
<my-element></my-element>
</body>
I think aot would be perfect for this scenario. Would that be a good assessment?
client1.js would be my bundled ng2 files. But what about compatibility? Will this work in all evergreen browsers? What if client1 also has ng2 files linked to their webpage?
Related
I have applied for Google AdSense for my website gulzari.in. I added the AdSense code between the <head> and </head> tags of .ejs file. After two weeks, I am getting the error "Connect your site to AdSense" even though I added the AdSense code between <head> and </head> tags of .ejs file.
I created the website using node js, express, MongoDB, .ejs, CSS and javascript.
Please help me! Where I am going wrong? Can I add Google Adsense code between the <head> and </head> in the .ejs file (https://ejs.co/) file? If not, what should I do to connect AdSense to my website created using nodejs, express, MongoDB, EJS, CSS and Javascript?
Created a simple search component in AEM and added following code in its JSP.
Also added autocomplete plugin and jquery plyugin file in clientlib node. But getting error "autocomplete is not a function" every time I try to run the page with this component. Is it not compatible to be used with AEM?
Using AEM 6.0 SP2
<% #include file="/libs/foundation/global.jsp"%>
<cq:includeClientLib categories="jquerysamples" />
<html>
<head>
<script>
$(function() {
var availableTutorials = [
"ActionScript",
"Boostrap",
"C",
"C++",
];
$( "#searchInput" ).autocomplete({
source: availableTutorials
});
});
</script>
</head>
<body>
<div class="formDiv">
<form id="form" >
<input type="text" id="searchInput" name="searchbox">
<div id="searchResults"/>
</form>
</div>
</body>
</html>
I recommend understanding how browsers parse HTML documents. http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#HTML_Parser is an introductory resource.
You have a JS script tag inside the head of your document. (this is immediate parse & execute)
there is a cq:includeClientLib outside of the document. I don't believe HTML5 behavior defines how this should behave.
no jQuery document onLoad is defined, so the browser attempts to run JavaScript before any DOM has been built.
I recommend:
Try moving the cq:includeClientLib inside the head.
Use the HTML5 doctype <!doctype html>. This should "kick" browsers into a consistent parsing mode (especially avoiding IE's myriad of quirks modes).
Move your script block to just inside the end of by body. Even better, wrap the JS with an onload handler to cause the JS to run AFTER the HTML has been parsed & the DOM has been built.
I got the solution. It was not binding the jquery-ui plugin. I added dependency of "cq:includeClientLib" for plugin folder to the js file I was using for autocomplete. It is working like a charm now.
I have a github webpage. How do I make a page displaying purely a pdf? I.e my cv?
To clarify, I wish the page to be filled only with the pdf - not any headings etc.
Just commit your pdf into your repo and it will be accessible just like any other file.
For instance, my resume is committed to my repo at https://github.com/xiongchiamiov/xiongchiamiov.github.com/blob/master/about/resume.pdf and is available on the web at https://changedmy.name/about/resume.pdf (I have a CNAME set up for changedmy.name).
Rather than redirecting to the PDF, you could embed it using an iframe or something like https://github.com/mozilla/pdf.js.
This way, the PDF will be accessible within the page and you could prevent it from being downloaded without viewing it in the browser.
It's not possible to make the page display "purely" the pdf, as to do that, you would need to alter the response headers, which obviously isn't possible with github pages.
You could have a JS redirect in your index.html that points to a pdf file that's also in your github-pages repo.
Suppose your file structure is like this:-
index.html
- cv(folder)
-----cv.pdf (your cv)
Then your code should look like this.
<html>
<body>
</body>
<script type="text/javascript">
document.location = "robin.github.io/cv/cv.pdf"
</script>
</html>
You can also do this:
<html lang="fr">
<head>
<!-- note the meta tag -->
<meta http-equiv="refresh" content="0; url=http://yourprofile.github.io/cv.pdf" />
<meta charset="utf-8">
<title>Will CV</title>
</head>
<body>
</body>
</html>
See Redirect from an HTML page for more info.
Github is using PDF.js to display PDFs, e.g. https://github.com/mozilla/pdf.js/blob/master/web/compressed.tracemonkey-pldi-09.pdf , you may find iframe with URL you can use to embed your resume (e.g. https://render.githubusercontent.com/view/pdf?commit=b261203018f847c89e05bb4c03c820fad0c90672&enc_url=68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6d6f7a696c6c612f7064662e6a732f623236313230333031386638343763383965303562623463303363383230666164306339303637322f7765622f636f6d707265737365642e74726163656d6f6e6b65792d706c64692d30392e706466&nwo=mozilla%2Fpdf.js&path=web%2Fcompressed.tracemonkey-pldi-09.pdf&repository_id=1663468#13eff6e4-ecdb-4fe1-85e4-b7a468697e26)
Facebook crawler not able to read my metatags on
http://nitansh.fwd.wf/article/travel/best-all-inclusive-resorts-for-romance/3189783/
but it successfully read the tags for the
http://nitansh.fwd.wf/nurture/
Both are on made using extending same template base.html and by injecting metatags.html into them. you can refer the HTML code by inspecting element.
While http://nitansh.fwd.wf/nurture/ shows the metadata even without having JavaScript enabled, http://nitansh.fwd.wf/article/travel/best-all-inclusive-resorts-for-romance/3189783/ shows only the following head when JavaScript is disabled:
<head>
<script src="//cdn.optimizely.com/js/687271175.js"></script>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<meta charset="UTF-8">
</head>
When you make the metadata available without requiring JavaScript, Facebook’s service will probably be able to parse it.
I have an oscommerce shopping cart site and I'm trying to set up an automatic redirect with 30-second time-delay from one product page to another product page, and include a message like "this prod. is now replaced by [new catalogue number]. You will be automatically redirected." How do I get into the raw HTML/PHP coding for each product so I can put a redirect meta-tag or javascript coding in? Note: I only want to set up the redirect for a handful of product pages (not all products currently on the site).
<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
window.location = "productpage.php"
}
//-->
</script>
</head>
<body onLoad="setTimeout('delayer()', 5000)">
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect, please update your bookmarks to our new
location!</p>
</body>
</html>
you can use Js redirect look like above
check from here > http://jsfiddle.net/JnUVF/