When I switch to device mode in Chrome, the $http.get request stops working

I have set up an API on a local virtual host using apache, with my client running on another one.

While my AngularJS application works perfectly in Chrome when device mode is turned off, I encounter an error when it's switched on:

angular.min.js:93 GET https://api.server.com 403 (Forbidden)

Below, I've included the relevant code snippet:

var storyFactory = angular.module('story.services', []);

storyFactory.factory('storyVideos', function ($http) {

    var factory = {
        story: {}
    };

    factory.getJSON = function (url, story_id) {
        return $http.get(url + '/5727cce5cf3ad/story/get/' + story_id).then(function (response) {
            return angular.extend(factory.story, response.data);
        });
    };

    return factory;
});

I have ruled out any server-side issues as there are no errors and the server accepts Access-Control-Allow-Origin.

I also attempted adding a manifest.json to my index.html, like this:

{
    "permissions": [
        "https://api.server.com/*"
    ]
}

Does anyone have insights into what might be causing this issue?

Thank you in advance.

Answer №1

When you encounter a 403 error, it indicates that the server has returned a Forbidden status code.

This type of error is typically related to issues on the server side.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the purpose of an Angular preflight options request in the context of the "Same Domain"?

I am currently puzzled by the way angular's preflight OPTIONS call (using jQuery) is determined to run before a request. My API call is directed towards a normal RESTful api at api.domain.co To resolve any domain issues, I added this host entry in m ...

Transforming Uint8Array into BigInt using Javascript

I've come across 3 different ways to convert a Uint8Array to BigInt, but each method seems to produce varying results. Can someone clarify which approach is correct and recommended? Utilizing the bigint-conversion library. The function bigintConversi ...

Arranging JavaScript object by object properties (name)

Can anyone assist me with my training? I am currently learning JavaScript (Js) and TypeScript (Ts) by working with an external public API. After successfully fetching and displaying my data, I now want to implement sorting functionality. My goal is to sor ...

Ways to identify when a React child element is overflowing

tl;dr How can I create a component that hides overflow and toggles views with a button? For example, the user can initially see tabs 1, 2, and 3 while tabs 4, 5, and 6 are hidden. Clicking a button will hide tabs 1, 2, and 3, and show tabs 4, 5, and 6 with ...

Using addThis on Ajax pages may result in Facebook (no title) errors

I have implemented addThis for creating share buttons on a project. The email and Twitter functionalities are working fine, but I am facing issues with Linkedin and Facebook. I understand that they require opengraph to function properly, but what if the co ...

PHP AJAX request failing to access current $_COOKIE['x']

I have encountered this issue before and was able to resolve it, but this time I am seeking additional assistance. Here is the specific scenario I observed while debugging: [home page load] Session::Load() $session_uid = (new) d149f... $row = false [log ...

JavaScript method to refine JSON Data

I have a JSON dataset of job information, with each job containing the following details: { jobs: [ { jobseeker_create_job_id: 1, job_title: "Fashion Designer", job_description: "Fashion Designer", salary: ...

Go to the dashboard once payment is successfully processed

In my app.js, I have defined the routes using React Router: <Router> <Routes> <Route exact path="/" element={<Home />} /> <Route element={<PrivateRoute />}> <Route exact path="/dashboard ...

Angular JS allows you to easily remove the # symbol from a URL, improving the

I am encountering a problem with the "#" symbol in my angular js website's URL. I need to remove the # from the URL but the method provided isn't working and the site is not displaying properly. Can someone advise me on how to successfully remove ...

Deleting Firestore ancestor documents and sub-collections that do not exist

My goal is to tidy up my collection data. The collection I'm working with is named "teams". Within this collection, there is a sub-collection called "players". I used a basic delete query in Firestore to remove the document under ...

Struggling to iterate through the children of a variable with the help of express-handlebars?

Currently, I am in the process of developing an application using Javascript along with express, express-handlebars, and MySQL. One of my main tasks is to establish a route that follows the pattern '/viewowner/:ID/scoreboards/:year' where ID sig ...

Tips for loading JSON data into the select2 plugin

My goal is to extract the last two letters (in this case "VA") from the data attribute (data-code="US-VA") of a jvectormap-element using JVectormap. I want to compare these letters with State objects in the database and then load corresponding counties in ...

An Exploration into the Error Situations of NPM Request Library

I'm encountering an issue with the callback in my request function. I'm trying to figure out the specific circumstances under which an error is passed to this callback. const req = require('request'); req('http://www.google.com&ap ...

Can I securely hand off a JavaScript callback to an FFI function that executes it in a separate thread?

I need to use a C function that takes a callback and executes it on a separate thread: void execute_in_new_thread(void (*callback)()) { // create a new thread and run `callback` in it ... } To accomplish this from JavaScript using Node-FFI, I have to ...

Using the loop function within HTML in JavaScript with React

I'm trying to loop over my SliderComponent function with different inputs within the HTML to generate multiple components, but I can't seem to get it to work. I came across a solution online that involves building a string and returning it as HTM ...

Dynamically generate a new array every time a numeral is encountered within the Input Array in JavaScript

I'm facing a dilemma. I have an array with user input that contains both numbers and strings, like this:- 3 apple Lemmon sugar 2 Ginger Ice This is the data I'm working with. My task is to manipulate the data so that "Whenever it encounters a n ...

Building a secure form validation system with Bootstrap 4 and integrating Stripe checkout functionality

Can someone help me figure out how to display the Stripe payment popup only when the Bootstrap 4 form is valid? ✔ The Bootstrap code is functioning correctly when the form is invalid. ...

Importing information from the Document Object Model in Vue.js, focusing on the action attribute of a form

Can Vue be used to create a binding where the data item in the Vue instance is initialized from the DOM? In my specific case, I want my Vue instance to receive the action attribute of a form element. For example, this is how my HTML would look like (the ...

Is incrementing x by 1 equivalent to x + 1?

I have a very basic angular application. It simply increases the value by 1 when clicked on using ng-click. Take a look at JSFiddle <div ng-app="app" ng-controller="ctrl"> <div ng-click="hello=hello+1">THIS WORKS ON CLICK: {{hello}}</d ...

Title of a design pattern: Transferring information between programming languages

I am trying to determine the name of this pattern, if it exists. It involves taking data from one programming language and using it in another. For example, PHP to Javascript. Initially, I thought it could be delegation, but I have seen this process done b ...