Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Tuesday, 22 September 2020

JavaScript - window.location.origin is not working in Internet Explorer


window.location.origin does not work on Internet Explorer. 

Follow the below code which will set the window.location.origin value by concatenating the portions of the URL. 

 if (!window.location.origin)
    window.location.origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? (':' + window.location.port) : ''); 
}

window.location properties

window.location.protocol         - Return the protocol of the current URL
window.location.hostname      - Returns the domain name of the web host
window.location.port                  - Number of the internet host port (of the current page)

Saturday, 29 August 2020

JavaScript - How to Download All Pictures from Instagram Profile on Single Click


1. Open Instagram profile you want to download images from in Chrome browser.

2. Open Chrome Console (Press F12).

3. Enter the below script in console window then all appearing images in the Instagram profile current screen will be opened into a new tab.


document.querySelectorAll("div.v1Nh3.kIKUG._bz0w a").forEach(function (item) { window.open(item.querySelector("img")["src"]) });