I am creating a Google Chrome extension that collects details of the page loaded in active tab.
I am getting the page title and URL correctly, but the page HTML source is not loading.
This is the code I am using to get title and URL:
chrome.tabs.getSelected(null, function(tab) {
u = tab.url;
t = tab.title;
document.write("Title: "+t+"<br>URL: "+u);
});
How can I get the HTML source of the tab page?
Related
Suppose I have a web page let's say rooms.html and the URL of that page is "http://localhost:8000/hotel/rooms/". In that HTML page there is a link to add_room.html page, when I click on that link, I get redirected to add_room.html whose URL is "http://localhost:8000/hotel/add_room/". I want to know what should I keep the UPL of this page. Should it be "http://localhost:8000/hotel/add_room/" or "http://localhost:8000/hotel/rooms/add_room/". So bascically my question is that when navigating to a different web page from a webpage should the URL of the new webpage contain the endpoint of the previous web page?
I'd like to get a thumbnail url of Google slides' page.
I checked that I can get a first page's thumbnail url by
var file = DriveApp.getFileById('IdOfSlide')
var url = Drive.Files.get(file.getId()).thumbnailLink
However I can not get a thumbnail url of a page in the middle of a slide, like page 10 or so.
Is there any way to get the thumbnail url of each page?
So I am using the rails 'link_to' method to redirect a user to an external website upon clicking on it (where the link is inside a google maps marker info box). I am using the Gmaps4rails gem. I am building the link inside the marker info window as below, in one of my controllers, where each #locations has a website as one of its attributes:
#hash = Gmaps4rails.build_markers(#locations) do |location, marker|
link = view_context.link_to "#{location.website}", location.website, target: "_blank"
description = "Website: #{link}"
marker.infowindow description
end
Everything gets plotted fine, and the links work fine for about half the markers, where if you click on the website link in the description you get redirected to the website in a new tab.
However, there are some website links in which my code acts strange; clicking on the url redirects you to my "website url + the marker's website url", concatenated into one url.Why is this happening?
For example, the url upon clicking on some of the website links in the markers redirects you to a url like this: "mywebsite.com/www.website_in_marker.com". And of course I get a page you are looking for does not exist error.
It's very likely that some of the links do not have a protocol (http, https, etc.) prepended to it. Anything in the href without a protocol is assumed to be a relative path, which is why some links are appended in relation to your site and others are not.
Going through and ensuring all links include a protocol would be one way to resolve the issue.
Hope it helps!
I am using the Static iFrame tab on Facebook for the purpose of sending a visitor that clicks on it to a website.
It has the option of redirecting, and does so in the same tab(window).
I would like it to redirect/open in a new tab.
I have coded it to redirect to the website in a new tab by the ordinary: _Blank In this case one has to (after clicking the app/tab) click the hyperlink for it to redirect to the new tab.
Is there code that redirects without (clicking) a hyperlink and opens in a new tab directly by just clicking the app/tab?
If you use the HTML editor in the tab settings and put this code in
<script type="text/javascript">
window.open("URL HERE", "_blank");
</script>
it will open in a new window, (users must allow pop-ups from facebook and have javascript enabled).
My website consists mainly of pages that are loaded into an iframe on the homepage.
When the pages are loaded they check if they have been opened outside the iframe and if they are the homepage is opened.
Now I want to open this specific page when the homepage is opened.
How do I send the information that the "browser came from" test.html? And then set the source of the iframe to be test.html?
The syntax
top.document.referrer
will let you access the parent of the iFrame;
document.getElementById('myIframeId').src = myUrl + 'test.html';
will set the iFrame source.
Pass the URL of the page to be framed in the query string of the URL to the page containing the frame.