How to get url of Google sheet macro web app page? - iframe

I have a HTML page with the javascript hosted as a webapp within Google Sheets.
The web app macro page URL that I see in the address bar is different from the URL that I am seeing when I do this in my javascript.
$(document).ready(function () {
alert(window.location.href);
});
The alert is giving me URL like this:
script.googleusercontent.com/userCodeAppPanel
While in the browser address bar, I have URL like this:
https://script.google.com/.../macros/fjfkdfgdkfgd
Any way to get the actual URL from the browser address var and save it in javascript variable which is which in my HTML page in google sheet, hosted as a web app?

Related

ERR_SSL_PROTOCOL_ERROR with image sources Razor pages

I am currently working on an ASP.NET Core application with Razor pages. The API endpoints are hosted in pre-production server. When I get an image link which is stored in the same server as the apis, through api, and want to display it in the razor page the image can't be shown due to ERR_SSL_PROTOCOL_ERROR. When I inspect element and get the src of the image tag and open it in a new tab it will open. Also if I use that source in a html page it still opens. Since the pre-production server does not have ssl certificate configured, is there any chances the PageModel abstract class of the razor page to have any validation on that, since it is working on plain html?
EDIT:
I am providing from the API the image tag as html:
<a href ="http://imagesourceIPExample">
<img src="http://imagesourceIPExample">
</a>
I am getting that string from an ajax request
$.ajax({
//ajax call params,
success: function(data){
$(`#messageDiv`).append(data.message);
}
}).
Now when I inspect the page and click the link in the anchor tag I would open fine. Also if I click it from the view. But the image isn't showing and the console shows that SSL_PROTOCOL_ERROR. And image link is http.
First of all, razor PageModel doesn't validate image loading.
It seems like you are working with secured https site and then when you append plain http image links, browser refuses to load them due to its Mixed Content policy. But when you load image in a separate window it will load just fine because the "mixed content" problem is gone, you load only http resource, no https involved.
Consider converting you image links to https, it should fix the problem.

Vue Router: access page directly from browser address bar

I'm using Vue Router history mode for my Vue.js app. My problem is that, when I try to refresh a page that is not the root page, or enter its URL in the browser address bar, "page not found" 404 is displayed.
Now, in the Vue Router guide they warn about this (see https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations), and suggest the solution to "add a simple catch-all fallback route to your server. If the URL doesn't match any static assets, it should serve the same index.html page that your app lives in".
With this solution, if I try to access one of my non-root pages (with corresponding URL) through the browser address bar, the root page will be displayed. Is this interpretation correct?
My question: is there a way to achieve the behaviour such that I can access my different pages directly from the browser address bar, and upon refresh stay on the same page?
If you use the aforementioned configuration. Your backend will route all requests to index.html. Then when the Vue-Router is mounted, it will check the URL and provide the corresponding component. The implementation above will work.

CSS not loading in Facebook canvas page

I have an application built with CodeIgniter that I have deployed as an app on Facebook.
I did this by adding it as a Canvas Page, so that it can be accessed at apps.facebook.com/myapp.
It loads up fine in the canvas, but none of my app's css is loaded. The page is without styling. Also none of my links seem to work.
Is this because of the base_url(); that I used throughout by app to link styelsheets and navigation?
Not sure what to do.
When I go directly to the app via the web address, which is the canvas url, it loads up and looks fine and as it should.
It might be your base_url(); set in Codeigniter since as you said it is used through the app to link everything.
When setting up the canvas in the dashboard you should have entered, and would have been required to enter a secure canvas url. This is the same as the canvas url except with https.
Change your base_url() in you config.php file to https and reload the canvas. This would have to change to the secure canvas url because you use the app as a logged in Facebook user. This si why the secure canvas url is required when setting up.
Let me know.

strange #.[some char] added to the page address in firefox

[Asp.net website, .net framework 4]
I noticed a strange thing in my web page address, With every new page requested the address of the page automatically attached with somthing like (#.UTedxFc5stU) at the end of the address after loading completed (maybe cause redirect too), this happend with only .net framework 4 applications,
and not happend with my other applications using 3.5 !.
this happend in firefox, chrome only, not with internet explorer.
this an example:
http://egypt.motorsyard.com/cars/used, open it in firefox and you will see somthing like this http://egypt.motorsyard.com/cars/used#.UTehGVc5stU
what is this, and how I stop it ?
Thanks for help.
Check your webconfig for url rewriting code.
i think this is URL redirecting issue.
Edit
If you have characters that look like #.TuomlFaZCSo in the URL those are address bar tracking codes. They provide a way to see how many people visit your site from users copying the URL from the address bar. If you have characters that include the name of a service, like #.TuomlFaZCSo.facebook then those are people returning from a link shared using that service.
To disable them using the client API, do this:
<script type="text/javascript">
var addthis_config = {
data_track_address_bar: false,
data_track_clickback: false
};
</script>
If you want to disable them using the Wordpress plugin look for their respective checkboxes on the Advanced tab of the AddThis plugin settings page.

windows mobile & google analytics

im doing a project with windows mobile .net framework
and i need to track every page with google analytics
therefore i create a web browser on every page and hidden it
the web browser will include a local html page
the html page has embed google analytics
however if i use traditional method or async method to integrate GA, it will throw js error with unspecified error, but the html is working if i put it to webserver
therefore i build a GA tracking image url to log the pageview and visitor count, however i found that the cookie can not be save, those every page will generate a new visitor count
any advise
If I understand your question correctly, you are simply trying to add GA tracking to your
WP7 app. If that is the case, you do not have to use a web browser or a tracking image to accomplish this. There is a project over on GitHub that will allow you to do this right in your .xaml pages.
https://github.com/maartenba/GoogleAnalyticsTracker
Get the code, compile it and add a reference to the lib in your phone project, then in your xaml code behind:
Loaded += (s, e) => {
using (var tracker = new Tracker("UA-XXXXXXXX-X", "appname")) {
tracker.TrackPageView("MainPage", "Main");
}
};
Put your GA account info in there for the Tracker object
And presto, you have GA tracking.
HTH

Resources