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

  • Home
  • SEARCH
  • 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 8204431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:54:06+00:00 2026-06-07T07:54:06+00:00

The following code snippets work in IE and Chrome but don’t work in Firefox

  • 0

The following code snippets work in IE and Chrome but don’t work in Firefox and I’m not sure why.

For this snippet, two links to Google appears in the webpage when opened in IE and Chrome but in Firefox nothing appears. It is located in a script tag in the body tag.

var varOne = document.createElement("a")
varOne.setAttribute("href", "http://www.google.com")
varOne.innerText = "Google"
document.body.appendChild(varOne) //attach the node to the body

var varOne = document.createElement("a")
varOne.setAttribute("href", "http://www.google.com")
varOne.textContent = "Google"
document.getElementById("bodyID").appendChild(varOne) //attach the node to the body

For this one, you click on the button to go to yahoo.com. When you press the browser’s back button, you go back to the earlier page but the javascript will run again forcing the browser to return to yahoo. Once you’ve left the original page you can’t go back and remain there without being redirected to yahoo. That’s what happens in IE and Chrome (which is what I intended just for learning purposes), but I can’t figure out why it doesn’t work in Firefox. When you come back to the original page from Yahoo, Firefox doesn’t force the browser forward like the other two browsers do.

<body>
<form>

    <input type="button" onclick="javascript: window.location='http://www.yahoo.com' "/>

</form>

<script type="text/javascript">

    alert("Problem?")
    window.history.forward()     
</script>
</body>
  • 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-06-07T07:54:07+00:00Added an answer on June 7, 2026 at 7:54 am

    Try passing 1 into the forward method:

    window.history.forward(1);
    

    If it doesn’t work then your probably out-of-luck as this seems to be a usability gray area between browser manufacturers. Allowing JavaScript (something other than the user) to change the current page without his/her direct involvement is a usability issue — akin to constantly firing pop-up/pop-under windows.

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

Sidebar

Related Questions

This following code snippet works fine using jQuery1.2.3, but it doesn’t work with latest
This following code snippet works in FF, IE and Chrome. However It does not
Why does following code snippet doesn't work? It doesn't gives any error, but also
The following code does not work correctly on Windows (but does on Linux): sock
Hey guys, the following snippet of jQuery code seems to work fine in Google
What is the difference between the following two snippets of code: using (Object o
The following code snippet in a Django template (v 1.1) doesn't work. {{ item.vendors.all.0
Consider the following code snippet about Twitter API. data.followers_count didn't work if placed in
The following code snippet is returning an error in firebug: Parameter is not an
The following code snippet is needed to capture html links for my site. Although,

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.