I’ve started work recently at a new company and they have an existing application with 1000s of lines of Javascript code. The baseline contains dozens of JS files with easily over 10,000 custom lines of code, they also use multiple 3rd party libraries such as Jquery, Livequery, JQTransform and others. One of the major complaints they have been receiving from
Tag: javascript
How to spoof site referrer?
I have 2 pages : 1.php and 2.php When the user arrives on 2.php, i want to show on 2.php that the user is arriving from google.com and NOT from 1.php I tried spoofing the header of 2.php using when i do a javascript document.write(document.referrer); it shows me 1.php Any help is appreciated. Answer The http referrer is a request
Call Javascript function from URL/address bar
Is it possible to call a javascript function from the URL? I am basically trying to leverage JS methods in a page I don’t have access to the source. Something like: http://www.example.com/mypage.aspx?javascript:printHelloWorld() I know if you put javascript:alert(“Hello World”); into the address bar it will work. I suspect the answer to this is no but, just wondered if there was
How to jump to top of browser page
I’m writing a modal popup and I need the browser to jump to the top of the screen when the open modal button is pressed. Is there a way to scroll the browser to the top using jQuery? Answer You can set the scrollTop, like this: Or if you want a little animation instead of a snap to the top:
How can I access Google Sheet spreadsheets only with Javascript?
I want to access Google Spreadsheets using JavaScript only (no .NET, C#, Java, etc.) I came here and was shocked to know that there is NO API for JavaScript to access Google Sheets. Please tell me how to access (CREATE/EDIT/DELETE) Google Sheets using JavaScript or any of its frameworks like jQuery. Answer I have created a simple javascript library that
Displaying crosshairs in the center of a JavaScript Google Map
I’d like to display a crosshair/reticule that’s fixed in the center of a Google Map, just as Wikimapia.org do. Unfortunately they are using v2 of the API and I’m using v3. The crosshair should remain fixed in the center as the user pans the map around. There’s no CENTER option for the ControlPosition enum, so I imagine any solution will
HTML5 Video Dimensions
I’m trying to get the dimensions of a video of which I’m overlaying onto a page with JavaScript, however it is returning the dimensions of the poster image instead of the actual video as it seems it’s being calculated before the video is loaded. Answer Spec: https://html.spec.whatwg.org/multipage/embedded-content.html#the-video-element
How do I hide the address bar on iPhone?
How do I hide the address bar on iPhone? I tried two different methods so far: The scroll down one pixel trick with JavaScript on page load And the following meta tags: Also this: I am completely confused. PS: Oh, I forgot a really important thing: the web page itself does not overflow the browser window. It probably is the
Client Checking file size using HTML5?
I’m trying to ride the HTML5 wave but I’m facing a small issue. Before HTML5 we were checking the file size with flash but now the trend is to avoid using flash in web apps. Is there any way to check the file size in the client side using HTML5? Answer This works. Place it inside an event listener for
How can I change an element’s text without changing its child elements?
I’d like to update element’s text dynamically: I’m new to jQuery, so this task seems to be quite challenging for me. Could someone point me to a function/selector to use? If it is possible, I’d like to do it without adding a new container for the text I need to change. Answer Mark’s got a better solution using jQuery, but