I'm using mysite.com/#contact as a landing page URL in some of the PPC campaigns, but when Google or Bing ads their URL parameters, I get url like mysite.com/#contact?campaign=x&source=x.. and the browser doesn't scroll down to the #contact anchor.
Any way to fix this? Or do I need to use a different URL?
In order to scroll down to the anchor it has to be at the very end of your url mysite.com?campaighn=x&source=x[...]#contact
I never used PPC ads so I don't know how to fix it, but at least that's the issue.
You could try to detect the URL parameter and use JavaScript to scroll to the specific location if true.
Untested combination of PHP / JS:
<?php if ( isset( $_GET['campaign'] ) { ?>
<script type="text/javascript">
//JS stuff
</script>
<?php } ?>
Related
I want to add a meta tag in my each individual page of life ray. I am could only find meta tag with description which is in the SEO of the pages in Control panel.
<link rel="alternate" href="http://example.com/xyz/abc" hreflang="en-au" />
Please help me out with this. I am unable to find an answer to this.
The best and permanent way is to create custom theme (or modify default one) and add general meta-tags, javascript / css files (which you want to appear on each page of portal) through head section of theme's portal_normal.vm file. However, if you want to restrict these tags for specific page(s) you can still do it through Velocity Objects like public / private layout, admin / user difference, current page name / URL, there are numerous options available.
If you are new to theme design, you can start with: Creating Liferay Themes
The other possible and quick way is to add js / css dynamically using javascript / jQuery as following:
if you are using pure javascript:
window.onload = function(){
loadjscssfile("myscript.js", "js");
loadjscssfile("javascript.php", "js");
loadjscssfile("mystyle.css", "css");
}
Or you can use jQuery:
jQuery(function(){
loadjscssfile("myscript.js", "js");
loadjscssfile("javascript.php", "js");
loadjscssfile("mystyle.css", "css");
});
general method:
function loadjscssfile(filename, filetype){
if (filetype=="js"){
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
}
else if (filetype=="css"){
var fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref);
}
Reference: http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
Add above code to the javascript section of the root of your pages.
Is there some way to restrict access to one our pages to only allow Facebook's OpenGraph scraper system? We have multiple likes on one page (similar to Digg) and each 'like' needs its own OpenGraph tags which we have on separate pages via the page story.php?1 and ?2 etc. We do not want the user to be able to view story.php as all they contain are the og: tags.
EDIT: It looks to be something I can do using the info in this post: http://facebook.stackoverflow.com/questions/7197919/how-can-i-move-a-url-via-301-redirect-and-retain-the-pages-facebook-likes-and-o
How can I exclude a particular domain from a HTTP 301 redirect. Can you help?
In the end I opted to add this to the story.php PHP code and it works perfectly:
<?php
if ($_SERVER["HTTP_USER_AGENT"] != "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)") {
redirect('http://www.mywebsite.com', 302);
}
function redirect($url, $type=302) {
if ($type == 301) header("HTTP/1.1 301 Moved Permanently");
header("Location: $url");
die();
}
?>
So, i have this problem with urls which was bothering me for quite a while for example now i create iframe with jquery and i get my html the way i want:
<iframe class="iframe" src="user/upload_image" name="iframeTarget">
And my current url is: user/messages/kazkoks but for some reason when iframe loads i get error which tells me that url user/messages/user/upload_image was not found.
So for some reason kohana adds me user/messages when i don't need it, how can i solve it?
As your current URL points relative to your user/messages directory, I think you should add a slash / in front of your url.
So your HTML would become:
<iframe class="iframe" src="/user/upload_image" name="iframeTarget">
EDIT: Another variant using the url helper:
<iframe class="iframe" src="<?php echo url::base().'user/upload_image'; ?>" name="iframeTarget">
EDIT 2: Yet another variant using JS
var url = window.location.pathname.replace(/\/user\/messages\/\w$/g, "/user/upload_image");
document.getElementByName("iframeTarget").setAttribute('src', url);
I am looking to open a dialog from a specific page and load dynamic data into the dialog.
On the main page I have a number of different links that when clicked provides more information on that link. All the data I have for that link is included on the main page. Somehow I would like to assign the dialog so that it is populated when the dialog opens.
I've tried something like this so far:
<?php foreach($offers as $offer) : ?>
<?php echo $offer->{'offer_name'}; ?>
<?php endforeach; ?>
Then I have an event catcher to catch the link click and then load the "data-desc" meta into the dialog but this doesn't work.
$('.offer').live('click', function(){
var data = $(this).attr('data-desc');
$("#data-desc").html(data);
$("#dialog-offer").dialog("open");
return false;
});
<div data-role="content" id="dialog-offer">
<p class="data-desc"></p>
</div>
I have been looking for an example on how to do this in jQM. This is such a basic necessity for jQM in general that I am surprised that I cannot find any examples. Could someone point me in the right direction. Thanks for the help.
You have a number of errors in your code:
You have given the id="dialog-offer" to a <div> with data-role="content". You should wrap that div in another div with data-role=page
You don't necessarily need to use $("#dialog-offer").dialog("open");. Just set <a href='#dialog-offer'>
You have the wrong selector for the html() call. The class name of the <p> is what you're using with an id-style selector
I have rewritten the code and posted it here: http://jsfiddle.net/PBb3h/
Not exactly like yours, but it does what you want.
How to change web-page without link, using greasemonkey? Is it even possible? For e.g. , I am on http://www.google.com/ and how can I get to http://www.youtube.com without a link?
// ==UserScript==
// #name _Redirect foo.
// #include http://www.google.com/
// ==/UserScript==
//--- Do it this way to keep Google in history (back button).
window.location.href = 'http://www.youtube.com/';
//--- Or, do it this way to keep Google out of history.
window.location.replace ('http://www.youtube.com/');
Use the redirect:
Put this HTML redirect code between and tags of your HTML code.
< meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">
source: http://www.web-source.net/html_redirect.htm
content is the number of seconds.
Here's an example where it refeshes the page: http://www.adelazzam.com/as.html