Domain redirection and url masking - url-rewriting

The image uploaded shows the post preview thumbnail of facebook.
(1)Consider a link x.com/abc which is redirected to y.com/xyz.
(2)When the link x.com/abc is shared on facebook it's preview is fetched from y.com/xyz.
(3)The preview thumbnail generated by facebook contains the domain y.com and not the x.com.
(4)How do we make the preview thumbnail show x.com and not the target url y.com.
The facebook screenshot show's that I shared url hivirality.com/abhishek which is redirected on citryxsolutions.in but the preview thumbnail contains the domain name of targeted url i.e citryxsolutions.in.
What are the possible cases to fix the issue.

You can do that, but it is a bit tricky. Instead of 301 redirect from x.com/abc to y.com/xyz. Your server should return HTML, which will redirect user through JS. This HTML should have Open Graph markup which Facebook is parsing. For example:
<!doctype html>
<html lang='en'>
<head>
<meta charset="utf-8" />
<meta property="og:url" content="URL" />
<meta property="og:title" content="TITLE" />
<meta property="og:type" content="website" />
<meta property="og:description" content="DESCRIPTION" />
<meta property="og:image" content="IMAGE URL" />
</head>
<body>
<script type="text/javascript">
if("false" == "false") {
window.location = "DESTINATION URL";
}
</script>
</body>
</html>
Where URL is x.com/abc
And DESTINATION URL is y.com/xyz
And you can check how Facebook reacts on that in FB debugger (also you can clear cache here): https://developers.facebook.com/tools/debug/

Related

Laravel 5.2 sending email as plain text, not html

Recently, I have upgraded my project from Laravel 5.1 to Laravel 5.2 and I am facing a strange issue.
The emails I was sending in HTML format are not getting sent as plain text with html tags inside.
The email body and subject are configurable so I read them from database, replace the variable values and set them as a body and subject.
With Laravel 5.1 there was no issue with it. The code I am using to send email is as below:
Mail::send('layouts.email', $emailData, function($message) use ($emailData, $email_subject){
$message->to($emailData['to'], $emailData['name'])->subject($email_subject);
});
I also have tried,
Mail::send(['html' => 'layouts.email'], $emailData, function($message) use ($emailData, $email_subject){
$message->to($emailData['to'], $emailData['name'])->subject($email_subject);
});
The layout.email.blade.php template is as below:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
{{$message_body}}
</body>
</html>
But the problem is still there. Can anybody guide me please?

Angular-UI-router Routing doesn't work in Ionic app

I have a problem where my Ionic app won't render my views but I'm not getting an error. When I run this app only the navbar and a blank page is showing.
index.html:
<html ng-app="App">
<head>
<!-- Project setup: https://scotch.io/tutorials/angularjs-best-practices-directory-structure -->
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>TEST Mobile</title>
<!-- Assets -->
<link href="assets/libs/ionic/ionic.css" rel="stylesheet" />
<script src="assets/libs/ionic/ionic.bundle.js"></script>
<script src="app/app.module.js"></script>
<script src="app/app.route.js"></script>
<!-- Controllers -->
<script src="app/components/home/homeController.js"></script>
<script src="app/components/projects/projectsController.js"></script>
<script src="app/components/vms/vmsController.js"></script>
<script src="app/components/auth/authController.js"></script>
<!-- Services -->
<script src="app/components/home/homeService.js"></script>
<script src="app/components/projects/projectsService.js"></script>
<script src="app/components/vms/vmsService.js"></script>
<script src="app/components/auth/authService.js"></script>
<!-- Cordova.js isn't loaded until build for a specific platform, this will give 404 when viewing from ordinary browser -->
<script src="cordova.js"></script>
</head>
<body>
<ion-nav-bar class="bar-assertive">
<ion-nav-back-button class="button-icon ion-arrow-left-c">
</ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</body>
</html>
I have a module file and a seperate routing file:
var app = angular.module('App', ['ionic']);
routing js file:
app.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url: '/home',
templateUrl: 'app/components/home/homeView.html',
controller: 'homeController'
});
$urlRouterProvider.otherwise('/home');
})
When I run this I only get the nav bar to show but not the ion-view home, which is now just for demonstration:
<ion-view view-title="Forgot Password">
<ion-content padding="true">
<p>
Yeah this is just a demo showing how views can be shown without tabs, then you can navigate
to views within tabs. Additionally, only one set of tabs needs to be written for all of the different views that should go inside the tabs. (Compared to written the same tab links in the footer of every view that's in a tab.)
</p>
<p>
There's no username/password, just click
the Sign-In button back a the sign-in view.
</p>
<p>
Return to Sign-In.
</p>
</ion-content>
</ion-view>
I suspect my issue is in the routing config but I wasn't able to find a working fix for this problem.
Add ui-view to your ion-nav-view in your index.html and it will work.
<ion-nav-view ui-view></ion-nav-view>
The issue wasn't with the routing config. The issue was that in another file (controller file) I also stated the angular.module('App', ['ionic']); this overrided my app.config.

firefox displays fallback page for files mentioned in Network section that not be cached

We are using HTML5 offline cache. We have polling code that checks whether the user in connected or disconnected to server/network. The online detection is done by calling one test jsp page which is mentioned in appcache file under network section. This checking works in Chrome by returning response status as 0.But it does not work in Firefox. Firefox displays fallback page instead of giving offline status (code 0). The respone status code is still 200 in this case.My appcache is:
CACHE MANIFEST
index.html
NETWORK:
TestIsOnline.jsp
FALLBACK:
/ fallback.html
And code to check status is:
$http({method: 'GET', url: 'TestIsOnline.jsp', cache: false}).success(function(data, status) {
console.log("user is online: status:"+status);
}).error(function(data, status) {
console.log("user is offline: status:"+status);
});
And calling test page 'TestIsOnline.jsp' contains:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<title>To test online status</title>
</head>
<body>
test page
</body>
</html>
When I disconnect server, In chrome I get output as "user is offline: status:0". in Firefox still I'm getting "user is online: status:200".
How to detect offline mode here?

How to exclude some content from _LyoutView being added to specific view

I have such script on my _LyoutView:
<noscript>
<meta http-equiv="refresh" content="0; URL=/Noscript">
</noscript>
But when user with javascript disabled redirected to that page, the infinity request of that page taking place because that page contains this code above as well.
So i just thought may be there is some things out of the box in ASP.NET MVC that can help?
Basically i want that that code from _LyoutView to be added to all views except Noscript view.
i can go like that on _LyoutView:
#if (ViewContext.Controller.ValueProvider.GetValue("action").RawValue != "Noscript")
{
<noscript>
<meta http-equiv="refresh" content="0; URL=/Noscript">
</noscript>
}
But may be there is more better way of doing that?
You can check the RawUrl property of the Request object to see if it contains the term "Noscript" which I'm assuming won't be part of the URL unless we're on that page.
#if(!Request.RawUrl.Contains("Noscript"))
{
<noscript>
<meta http-equiv="refresh" content="0; URL=/Noscript">
</noscript>
}

Phonegap-0.94, Apple iPhone OS 4.2.1 : Youtube links not launching Youtube app

I created a basic project using phonegap. and added this bit of html code to my index.hmtl
Clicking on the youtube link launches Youtube mobile site in Phonegap (once it's launched, there is no way to go back to my phonegap view)
How do I enable HREF links to open native youtube app on iPhone/iPad?
The href links are compliant with Apple specs for Youtube Links as in
https://developer.apple.com/library/safari/#featuredarticles/iPhoneURLScheme_Reference/Articles/YouTubeLinks.html
My Index.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<!-- Change this if you want to allow scaling -->
<meta name="viewport" content="width=default-width; user-
scalable=no" />
<meta http-equiv="Content-type" content="text/html;
charset=utf-8">
<title>MyTube</title>
<!-- iPad/iPhone specific css below, add after your main css >
<link rel="stylesheet" media="only screen and (max-device-width:
1024px)" href="ipad.css" type="text/css" />
<link rel="stylesheet" media="only screen and (max-device-width:
480px)" href="iphone.css" type="text/css" />
-->
<!-- If you application is targeting iOS BEFORE 4.0 you MUST put
json2.js from http://www.JSON.org/json2.js into your www directory and
include it here -->
<script type="text/javascript" charset="utf-8" src="phonegap.
0.9.4.min.js"></script>
<script type="text/javascript" charset="utf-8">
// If you want to prevent dragging, uncomment this section
/*
function preventBehavior(e)
{
e.preventDefault();
};
document.addEventListener("touchmove", preventBehavior, false);
*/
function onBodyLoad()
{
document.addEventListener("deviceready",onDeviceReady,false);
}
/* When this function is called, PhoneGap has been initialized and is
ready to roll */
function onDeviceReady()
{
// do your thing!
}
</script>
</head>
<body onload="onBodyLoad()">
<h1> My You tube Links </h1>
<a href="http://www.youtube.com/v/NkTrG-gpIzE"> SOURCE-CODE
Trailer </a>
</body>
</html>
I tried and got the same result. Which is weird, because I also assumed links to YT would trigger the native YouTube app. The one thing I found is that an embed will do what you're after, but haven't come across any other way.
<object width="300" height="199">
<param name="movie" value="http://www.youtube.com/v/NkTrG-gpIzE?fs=1&hl=en_US&rel=0"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/NkTrG-gpIzE?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="300" height="199"></embed>
</object>
My only other suggestion was to have you post on the PhoneGap Google Group, but I see that you've just done that a few minutes ago. If I find anything else I'll try to share it, but the embed approach has been the only one that's worked so far.

Resources