Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5998185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:22:11+00:00 2026-05-23T00:22:11+00:00

I have a srcURL variable which gets a path of the form /myFolder/myFile.jpg Now

  • 0

I have a srcURL variable which gets a path of the form /myFolder/myFile.jpg

Now this gets assigned to the img element..which obviously would call it with the complete path https://mySite.com/myFolder/myFile.jpg

Now I somehow want the https to be replaced/enforced with http using Javascript..

I am not sure if I can do this with the “replace()” method since I only get the path “/myFolder/myFile.jpg” in the srcURL variable and not with https..

How can I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:22:11+00:00Added an answer on May 23, 2026 at 12:22 am

    You are using a relative path. You need to use an explicit path when setting the src of the URL.

    srcURL = '/myFolder/myFile.jpg';
    srcURL = 'http://' + window.location.host + srcURL;
    
    // srcURL == 'http://<yourdomainname>/myFolder/myFile.jpg'
    

    Note: you’ll probably get a warning message saying some parts of your page may be unsecure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this string <p><img src=http://www.foo.com/bar.jpg></p><p>other content here</p> I need to extract the src
have written this little class, which generates a UUID every time an object of
I have a form inside an iframe which is inside a jQuery UI dialog
I'm working on a web page and I have this function which is showing
I have an iframe with parameters inside the src url like this: <iframe src=http://www.form-page.com?suppressRedirect=1&A=1841
I have around 8 img src tags that start like this: <img src= id=joinCityResponse
I have a content script which reads data and using google tts service gets
I have this html: <div class=vt ddsitem> <a href=url><img class=pt id=xyz1 src=url></a> <div> <img
I have below structure <div class=mybox> <div id=imageslide> <a href=><img src=url /></a> </div> </div>
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.